PHP Класс Noherczeg\Breadcrumb\Breadcrumb

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( $base_url = null, $config = 'en' )
append ( String $raw_name = null, String $side = 'right', boolean $base = false, mixed $translate = true, boolean $disabled = false ) : Breadcrumb append: Appends an element to the list of Segments. Can do it from both sides, and can mark an element as base element, which means that it'll point to the base URL.
build ( String $format = null, String | null $casing = null, boolean $last_not_link = true, String | null $separator = null, array $customizations = [], boolean $different_links = false ) : String Builder method which returns with a result type as required.
disable ( integer $pos = null ) : Breadcrumb Disables a Segment at the given position.
from ( mixed $input = null ) : Breadcrumb from: Reads the first parameter which can be a String, PHP array, JSON array and creates + appends Segments from it in one step.
map ( array $rawArray ) : Breadcrumb Registers a list of title => link pairs with the package.
num_of_segments ( ) : integer num_of_segments: Returns the number of segments which are registered in the system.
registered ( ) : array registered: Returns all the registered Segments.
remove ( integer $pos, boolean $reindex_after_remove = false ) : Breadcrumb remove: Removes an element from the list, optionally can reindex the list after removal.
segment ( String $id ) : Segment segment: A getter which returns the Segment which is at the given position.
setBaseURL ( String $urlString ) : Breadcrumb Sets the base URL for the package.
setConfiguration ( mixed $config ) : Breadcrumb Dynamic Package configuration

Приватные методы

Метод Описание
appendToSide ( $segment, $side )
checkAppendArgs ( $raw_name, $side )
checkFromArgs ( $input )
inputToArray ( $input = null )
loadBuilders ( ) : array
safeArrayAssignment ( $input ) : array
setParam ( mixed $to_this ) : String setParam: basic system method, don't bother.

Описание методов

__construct() публичный Метод

public __construct ( $base_url = null, $config = 'en' )

append() публичный Метод

Supports method chaining. Warning! It doesn't fix multiple "base element" issues, so it's up to the programmer to append base elements wisely!
public append ( String $raw_name = null, String $side = 'right', boolean $base = false, mixed $translate = true, boolean $disabled = false ) : Breadcrumb
$raw_name String Name of the appendable Segment
$side String Which side to place the segment in the array
$base boolean true if it is referring to the base url
$translate mixed Set to true if you want to use the provided dictionary, set to false if you want to skip translation, or set to a specific string to assign that value
$disabled boolean
Результат Breadcrumb

build() публичный Метод

Supports separator switching, casing switching, and custom property insertion from an array (only if output is set to html!).
public build ( String $format = null, String | null $casing = null, boolean $last_not_link = true, String | null $separator = null, array $customizations = [], boolean $different_links = false ) : String
$format String Format of the output
$casing String | null Casing of Segments
$last_not_link boolean
$separator String | null Separator String (not there in Foundation!)
$customizations array Array of properties (only in HTML!)
$different_links boolean
Результат String

disable() публичный Метод

Segment will still remain, but won't be translated, and will be handled specially in the building process. Supports method chaining.
public disable ( integer $pos = null ) : Breadcrumb
$pos integer Position of the element
Результат Breadcrumb

from() публичный Метод

Supports method chaining.
public from ( mixed $input = null ) : Breadcrumb
$input mixed Either: PHP array, JSON array, URI string
Результат Breadcrumb

map() публичный Метод

All of the given data will be used as-is no translation, no URL conversion will be applied!
public map ( array $rawArray ) : Breadcrumb
$rawArray array Array with title => link pairs
Результат Breadcrumb

num_of_segments() публичный Метод

num_of_segments: Returns the number of segments which are registered in the system.
public num_of_segments ( ) : integer
Результат integer

registered() публичный Метод

registered: Returns all the registered Segments.
public registered ( ) : array
Результат array

remove() публичный Метод

Supports method chaining.
public remove ( integer $pos, boolean $reindex_after_remove = false ) : Breadcrumb
$pos integer Position of the element
$reindex_after_remove boolean To do the reindex or not
Результат Breadcrumb

segment() публичный Метод

segment: A getter which returns the Segment which is at the given position.
public segment ( String $id ) : Segment
$id String The ID of the required Segment.
Результат Segment

setBaseURL() публичный Метод

Sets the base URL for the package.
public setBaseURL ( String $urlString ) : Breadcrumb
$urlString String Base URL
Результат Breadcrumb

setConfiguration() публичный Метод

Dynamic Package configuration
public setConfiguration ( mixed $config ) : Breadcrumb
$config mixed Configurations (either lang code as String, or configuration array)
Результат Breadcrumb