BreadcrumbsHelper to register and display a breadcrumb trail for your views
$_defaultConfig
protected array
$crumbs
protected array
$helpers
public array
$Url
public Search a crumb in the current stack which title matches the one provided as argument. If found, the index of the matching crumb will be returned.
add( string|array $title , string|array|null $url null , array $options [] )
Add a crumb to the end of the trail.
$title
If provided as a string, it represents the title of the crumb. Alternatively, if you want to add multiple crumbs at once, you can provide an array, with each values being a single crumb. Arrays are expected to be of this form: - title The title of the crumb - link The link of the crumb. If not provided, no link will be made - options Options of the crumb. See description of params option of this method.
$url
optional null URL of the crumb. Either a string, an array of route params to pass to Url::build() or null / empty if the crumb does not have a link.
$options
optional [] Array of options. These options will be used as attributes HTML attribute the crumb will be rendered in (a
findCrumb( string $title )
Search a crumb in the current stack which title matches the one provided as argument. If found, the index of the matching crumb will be returned.
$title
insertAfter( string $matchingTitle , string $title , string|array|null $url null , array $options [] )
Insert a crumb after the first matching crumb with the specified title.
Finds the index of the first crumb that matches the provided class, and inserts the supplied callable before it.
$matchingTitle
$title
$url
optional null URL of the crumb. Either a string, an array of route params to pass to Url::build() or null / empty if the crumb does not have a link.
$options
optional [] Array of options. These options will be used as attributes HTML attribute the crumb will be rendered in (a
insertAt( integer $index , string $title , string|array|null $url null , array $options [] )
Insert a crumb at a specific index.
If the index already exists, the new crumb will be inserted, and the existing element will be shifted one index greater. If the index is out of bounds, it will throw an exception.
$index
$title
$url
optional null URL of the crumb. Either a string, an array of route params to pass to Url::build() or null / empty if the crumb does not have a link.
$options
optional [] Array of options. These options will be used as attributes HTML attribute the crumb will be rendered in (a
insertBefore( string $matchingTitle , string $title , string|array|null $url null , array $options [] )
Insert a crumb before the first matching crumb with the specified title.
Finds the index of the first crumb that matches the provided class, and inserts the supplied callable before it.
$matchingTitle
$title
$url
optional null URL of the crumb. Either a string, an array of route params to pass to Url::build() or null / empty if the crumb does not have a link.
$options
optional [] Array of options. These options will be used as attributes HTML attribute the crumb will be rendered in (a
prepend( string $title , string|array|null $url null , array $options [] )
Prepend a crumb to the start of the queue.
$title
If provided as a string, it represents the title of the crumb. Alternatively, if you want to add multiple crumbs at once, you can provide an array, with each values being a single crumb. Arrays are expected to be of this form: - title The title of the crumb - link The link of the crumb. If not provided, no link will be made - options Options of the crumb. See description of params option of this method.
$url
optional null URL of the crumb. Either a string, an array of route params to pass to Url::build() or null / empty if the crumb does not have a link.
$options
optional [] Array of options. These options will be used as attributes HTML attribute the crumb will be rendered in (a
render( array $attributes [] , array $separator [] )
Renders the breadcrumbs trail.
$attributes
optional [] Array of attributes applied to the wrapper
template. Accepts the templateVars
key to allow the insertion of custom template variable in the template.
$separator
optional [] Array of attributes for the separator
template. Possible properties are : - separator The string to be displayed as a separator - templateVars Allows the insertion of custom template variable in the template - innerAttrs To provide attributes in case your separator is divided in two elements. All other properties will be converted as HTML attributes and will replace the attrs key in the template. If you use the default for this option (empty), it will not render a separator.
__call( string $method , array $params )
Provide non fatal errors on missing method calls.
$method
$params
__construct( Cake\View\View $View , array $config [] )
Default Constructor
Cake\View\View
$View
$config
optional [] __debugInfo( )
Returns an array that can be used to describe the internal state of this object.
__get( string $name )
Lazy loads helpers.
$name
Cake\View\Helper
|null_confirm( string $message , string $okCode , string $cancelCode '' , array $options [] )
Returns a string to be used as onclick handler for confirm dialogs.
$message
$okCode
$cancelCode
optional '' $options
optional [] addClass( array $options [] , string|null $class null , string $key 'class' )
Adds the given class to the element options
$options
optional [] $class
optional null $key
optional 'class' getView( )
Get the view instance this helper is bound to.
Cake\View\View
implementedEvents( )
Get the View callbacks this helper is interested in.
By defining one of the callback methods a helper is assumed to be interested in the related event.
Override this method if you need to add non-conventional event listeners. Or if you want helpers to listen to non-standard events.
Cake\Event\EventListenerInterface::implementedEvents()
initialize( array $config )
Constructor hook method.
Implement this method to avoid having to overwrite the constructor and call parent.
$config
formatTemplate( string $name , array $data )
Formats a template string with $data
$name
$data
getTemplates( string|null $template null )
Gets templates to use or a specific template.
$template
optional null setTemplates( array $templates )
Sets templates to use.
$templates
templater( )
Returns the templater instance.
Cake\View\StringTemplate
templates( string|null|array $templates null )
Gets/sets templates to use.
$templates
optional null null or string allow reading templates. An array allows templates to be added.
_configDelete( string $key )
Deletes a single config key.
$key
Cake\Core\Exception\Exception
_configRead( string|null $key )
Reads a config key.
$key
_configWrite( string|array $key , mixed $value , boolean|string $merge false )
Writes a config key.
$key
$value
$merge
optional false True to merge recursively, 'shallow' for simple merge, false to overwrite, defaults to false.
Cake\Core\Exception\Exception
config( string|array|null $key null , mixed|null $value null , boolean $merge true )
Gets/Sets the config.
Reading the whole config:
$this->config();
Reading a specific value:
$this->config('key');
Reading a nested value:
$this->config('some.nested.key');
Setting a specific value:
$this->config('key', $value);
Setting a nested value:
$this->config('some.nested.key', $value);
Updating multiple config settings at the same time:
$this->config(['one' => 'value', 'another' => 'value']);
$key
optional null $value
optional null $merge
optional true Cake\Core\Exception\Exception
configShallow( string|array $key , mixed|null $value null )
Merge provided config with existing config. Unlike config()
which does a recursive merge for nested keys, this method does a simple merge.
Setting a specific value:
$this->config('key', $value);
Setting a nested value:
$this->config('some.nested.key', $value);
Updating multiple config settings at the same time:
$this->config(['one' => 'value', 'another' => 'value']);
$key
$value
optional null getConfig( string|null $key null )
Returns the config.
Reading the whole config:
$this->getConfig();
Reading a specific value:
$this->getConfig('key');
Reading a nested value:
$this->getConfig('some.nested.key');
$key
optional null setConfig( string|array $key , mixed|null $value null , boolean $merge true )
Sets the config.
Setting a specific value:
$this->setConfig('key', $value);
Setting a nested value:
$this->setConfig('some.nested.key', $value);
Updating multiple config settings at the same time:
$this->setConfig(['one' => 'value', 'another' => 'value']);
$key
$value
optional null $merge
optional true Cake\Core\Exception\Exception
protected array
Default config for the helper.
[ 'templates' => [ 'wrapper' => '<ul{{attrs}}>{{content}}</ul>', 'item' => '<li{{attrs}}><a href="{{url}}"{{innerAttrs}}>{{title}}</a></li>{{separator}}', 'itemWithoutLink' => '<li{{attrs}}><span{{innerAttrs}}>{{title}}</span></li>{{separator}}', 'separator' => '<li{{attrs}}><span{{innerAttrs}}>{{separator}}</span></li>' ] ]
public Cake\View\Helper\UrlHelper
© 2005–2017 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.4/class-Cake.View.Helper.BreadcrumbsHelper.html