Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions | Protected Attributes
Breadcrumbs Class Reference
Inheritance diagram for Breadcrumbs:
Template AbstractBlock DataObject BlockInterface

Public Member Functions

 __construct (Template\Context $context, array $data=[], Json $serializer=null)
 
 addCrumb ($crumbName, $crumbInfo)
 
 getCacheKeyInfo ()
 
- Public Member Functions inherited from Template
 __construct (Template\Context $context, array $data=[])
 
 setTemplateContext ($templateContext)
 
 getTemplate ()
 
 setTemplate ($template)
 
 getTemplateFile ($template=null)
 
 getArea ()
 
 assign ($key, $value=null)
 
 fetchView ($fileName)
 
 getBaseUrl ()
 
 getObjectData (\Magento\Framework\DataObject $object, $key)
 
 getCacheKeyInfo ()
 
- Public Member Functions inherited from AbstractBlock
 __construct (\Magento\Framework\View\Element\Context $context, array $data=[])
 
 getJsLayout ()
 
 getRequest ()
 
 getParentBlock ()
 
 setLayout (\Magento\Framework\View\LayoutInterface $layout)
 
 getLayout ()
 
 setNameInLayout ($name)
 
 getChildNames ()
 
 setAttribute ($name, $value=null)
 
 setChild ($alias, $block)
 
 addChild ($alias, $block, $data=[])
 
 unsetChild ($alias)
 
 unsetCallChild ($alias, $callback, $result, $params)
 
 unsetChildren ()
 
 getChildBlock ($alias)
 
 getChildHtml ($alias='', $useCache=true)
 
 getChildChildHtml ($alias, $childChildAlias='', $useCache=true)
 
 getBlockHtml ($name)
 
 insert ($element, $siblingName=0, $after=true, $alias='')
 
 append ($element, $alias='')
 
 getGroupChildNames ($groupName)
 
 getChildData ($alias, $key='')
 
 getUiId ($arg1=null, $arg2=null, $arg3=null, $arg4=null, $arg5=null)
 
 getJsId ($arg1=null, $arg2=null, $arg3=null, $arg4=null, $arg5=null)
 
 getUrl ($route='', $params=[])
 
 getViewFileUrl ($fileId, array $params=[])
 
 formatDate ( $date=null, $format=\IntlDateFormatter::SHORT, $showTime=false, $timezone=null)
 
 formatTime ( $time=null, $format=\IntlDateFormatter::SHORT, $showDate=false)
 
 getModuleName ()
 
 escapeHtml ($data, $allowedTags=null)
 
 escapeJs ($string)
 
 escapeHtmlAttr ($string, $escapeSingleQuote=true)
 
 escapeCss ($string)
 
 stripTags ($data, $allowableTags=null, $allowHtmlEntities=false)
 
 escapeUrl ($string)
 
 escapeXssInUrl ($data)
 
 escapeQuote ($data, $addSlashes=false)
 
 escapeJsQuote ($data, $quote='\'')
 
 getNameInLayout ()
 
 getCacheKeyInfo ()
 
 getCacheKey ()
 
 getVar ($name, $module=null)
 
 isScopePrivate ()
 
- Public Member Functions inherited from DataObject
 __construct (array $data=[])
 
 addData (array $arr)
 
 setData ($key, $value=null)
 
 unsetData ($key=null)
 
 getData ($key='', $index=null)
 
 getDataByPath ($path)
 
 getDataByKey ($key)
 
 setDataUsingMethod ($key, $args=[])
 
 getDataUsingMethod ($key, $args=null)
 
 hasData ($key='')
 
 toArray (array $keys=[])
 
 convertToArray (array $keys=[])
 
 toXml (array $keys=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 convertToXml (array $arrAttributes=[], $rootName='item', $addOpenTag=false, $addCdata=true)
 
 toJson (array $keys=[])
 
 convertToJson (array $keys=[])
 
 toString ($format='')
 
 __call ($method, $args)
 
 isEmpty ()
 
 serialize ($keys=[], $valueSeparator='=', $fieldSeparator=' ', $quote='"')
 
 debug ($data=null, &$objects=[])
 
 offsetSet ($offset, $value)
 
 offsetExists ($offset)
 
 offsetUnset ($offset)
 
 offsetGet ($offset)
 
- Public Member Functions inherited from BlockInterface
 toHtml ()
 

Protected Member Functions

 _toHtml ()
 
- Protected Member Functions inherited from Template
 _construct ()
 
 _toHtml ()
 
 getRootDirectory ()
 
 getMediaDirectory ()
 
- Protected Member Functions inherited from AbstractBlock
 _construct ()
 
 _prepareLayout ()
 
 _beforeToHtml ()
 
 _afterToHtml ($html)
 
 _toHtml ()
 
 _getNotFoundUrl ($route='', $params=['_direct'=> 'core/index/notFound'])
 
 getCacheTags ()
 
 getCacheLifetime ()
 
 _loadCache ()
 
 _saveCache ($data)
 
 _getSidPlaceholder ($cacheKey=null)
 
- Protected Member Functions inherited from DataObject
 _getData ($key)
 
 _underscore ($name)
 

Protected Attributes

 $_template = 'Magento_Theme::html/breadcrumbs.phtml'
 
 $_properties = ['label', 'title', 'link', 'first', 'last', 'readonly']
 
 $_crumbs
 
 $_cacheKeyInfo
 
- Protected Attributes inherited from Template
 $_viewVars = []
 
 $_baseUrl
 
 $_jsUrl
 
 $_allowSymlinks
 
 $_filesystem
 
 $_template
 
 $templateEnginePool
 
 $_storeManager
 
 $_appState
 
 $directory
 
 $templateContext
 
 $pageConfig
 
 $resolver
 
 $validator
 
- Protected Attributes inherited from AbstractBlock
 $_design
 
 $_session
 
 $_sidResolver
 
 $_nameInLayout
 
 $_layout
 
 $jsLayout = []
 
 $_request
 
 $_urlBuilder
 
 $_eventManager
 
 $_frontController
 
 $_assetRepo
 
 $_viewConfig
 
 $_cacheState
 
 $_logger
 
 $_escaper
 
 $filterManager
 
 $_localeDate
 
 $inlineTranslation
 
 $_isScopePrivate = false
 
 $_scopeConfig
 
 $_cache
 
- Protected Attributes inherited from DataObject
 $_data = []
 

Additional Inherited Members

- Static Public Member Functions inherited from AbstractBlock
static extractModuleName ($className)
 
- Data Fields inherited from Template
const XML_PATH_TEMPLATE_ALLOW_SYMLINK = 'dev/template/allow_symlink'
 
- Data Fields inherited from AbstractBlock
const CACHE_GROUP = \Magento\Framework\App\Cache\Type\Block::TYPE_IDENTIFIER
 
const CACHE_KEY_PREFIX = 'BLOCK_'
 
- Static Protected Attributes inherited from DataObject
static $_underscoreCache = []
 

Detailed Description

Html page breadcrumbs block

@api

Since
100.0.2

Definition at line 17 of file Breadcrumbs.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( Template\Context  $context,
array  $data = [],
Json  $serializer = null 
)
Parameters
Template\Context$context
array$data
Json | null$serializer

Definition at line 57 of file Breadcrumbs.php.

61  {
62  parent::__construct($context, $data);
63  $this->serializer =
65  }

Member Function Documentation

◆ _toHtml()

_toHtml ( )
protected

Render block HTML

Returns
string

Definition at line 112 of file Breadcrumbs.php.

113  {
114  if (is_array($this->_crumbs)) {
115  reset($this->_crumbs);
116  $this->_crumbs[key($this->_crumbs)]['first'] = true;
117  end($this->_crumbs);
118  $this->_crumbs[key($this->_crumbs)]['last'] = true;
119  }
120  $this->assign('crumbs', $this->_crumbs);
121 
122  return parent::_toHtml();
123  }

◆ addCrumb()

addCrumb (   $crumbName,
  $crumbInfo 
)

Add crumb

Parameters
string$crumbName
array$crumbInfo
Returns
$this

Definition at line 74 of file Breadcrumbs.php.

75  {
76  foreach ($this->_properties as $key) {
77  if (!isset($crumbInfo[$key])) {
78  $crumbInfo[$key] = null;
79  }
80  }
81 
82  if (!isset($this->_crumbs[$crumbName]) || !$this->_crumbs[$crumbName]['readonly']) {
83  $this->_crumbs[$crumbName] = $crumbInfo;
84  }
85 
86  return $this;
87  }

◆ getCacheKeyInfo()

getCacheKeyInfo ( )

Get cache key informative items

Provide string array key to share specific info item with FPC placeholder

Returns
array

Definition at line 96 of file Breadcrumbs.php.

97  {
98  if ($this->_cacheKeyInfo === null) {
99  $this->_cacheKeyInfo = parent::getCacheKeyInfo() + [
100  'crumbs' => base64_encode($this->serializer->serialize($this->_crumbs)),
101  'name' => $this->getNameInLayout()
102  ];
103  }
104  return $this->_cacheKeyInfo;
105  }

Field Documentation

◆ $_cacheKeyInfo

$_cacheKeyInfo
protected

Definition at line 45 of file Breadcrumbs.php.

◆ $_crumbs

$_crumbs
protected

Definition at line 38 of file Breadcrumbs.php.

◆ $_properties

$_properties = ['label', 'title', 'link', 'first', 'last', 'readonly']
protected

Definition at line 31 of file Breadcrumbs.php.

◆ $_template

$_template = 'Magento_Theme::html/breadcrumbs.phtml'
protected

Definition at line 24 of file Breadcrumbs.php.


The documentation for this class was generated from the following file: