187 $this->_request = $context->getRequest();
188 $this->_layout = $context->getLayout();
189 $this->_eventManager = $context->getEventManager();
190 $this->_urlBuilder = $context->getUrlBuilder();
191 $this->_cache = $context->getCache();
192 $this->_design = $context->getDesignPackage();
193 $this->_session = $context->getSession();
194 $this->_sidResolver = $context->getSidResolver();
195 $this->_scopeConfig = $context->getScopeConfig();
196 $this->_assetRepo = $context->getAssetRepository();
197 $this->_viewConfig = $context->getViewConfig();
198 $this->_cacheState = $context->getCacheState();
199 $this->_logger = $context->getLogger();
200 $this->_escaper = $context->getEscaper();
201 $this->filterManager = $context->getFilterManager();
202 $this->_localeDate = $context->getLocaleDate();
203 $this->inlineTranslation = $context->getInlineTranslation();
204 if (isset(
$data[
'jsLayout'])) {
205 $this->jsLayout =
$data[
'jsLayout'];
206 unset(
$data[
'jsLayout']);
208 parent::__construct(
$data);
219 return json_encode($this->jsLayout);
259 return $layout->getBlock($parentName);
272 $this->_layout = $layout;
297 if (!$this->_layout) {
298 throw new \Magento\Framework\Exception\LocalizedException(
313 if (!empty($this->_nameInLayout) && $this->_layout) {
314 if (
$name === $this->_nameInLayout) {
317 $this->_layout->renameElement($this->_nameInLayout,
$name);
319 $this->_nameInLayout =
$name;
365 if ($layout->getChildName($thisName,
$alias)) {
368 if (
$block instanceof
self) {
435 $args = func_get_args();
436 $alias = array_shift($args);
437 $callback = array_shift($args);
438 $result = (string)array_shift($args);
444 if (
$result == call_user_func_array([&$child, $callback],
$params)) {
466 $layout->unsetChild(
$name, $childName);
485 return $layout->getBlock(
$name);
508 $out = $layout->renderElement($childName, $useCache);
511 foreach ($layout->getChildNames(
$name) as $child) {
512 $out .= $layout->renderElement($child, $useCache);
538 if ($childChildAlias) {
539 $childChildName = $layout->getChildName($childName, $childChildAlias);
540 $out = $layout->renderElement($childChildName, $useCache);
542 foreach ($layout->getChildNames($childName) as $childChild) {
543 $out .= $layout->renderElement($childChild, $useCache);
587 $layout->reorderChild($this->_nameInLayout,
$elementName, $siblingName, $after);
629 return $child->getData($key);
653 $this->_eventManager->dispatch(
'view_block_abstract_to_html_before', [
'block' => $this]);
654 if ($this->_scopeConfig->getValue(
655 'advanced/modules_disable_output/' . $this->getModuleName(),
662 if ($html ===
false) {
663 if ($this->
hasData(
'translate_inline')) {
664 $this->inlineTranslation->suspend($this->
getData(
'translate_inline'));
671 if ($this->
hasData(
'translate_inline')) {
672 $this->inlineTranslation->resume();
678 $transportObject = new \Magento\Framework\DataObject(
683 $this->_eventManager->dispatch(
'view_block_abstract_to_html_after', [
685 'transport' => $transportObject
687 $html = $transportObject->getHtml();
727 public function getUiId($arg1 =
null, $arg2 =
null, $arg3 =
null, $arg4 =
null, $arg5 =
null)
729 return ' data-ui-id="' . $this->
getJsId($arg1, $arg2, $arg3, $arg4, $arg5) .
'" ';
744 public function getJsId($arg1 =
null, $arg2 =
null, $arg3 =
null, $arg4 =
null, $arg5 =
null)
747 if ($arg1 !==
null) {
750 if ($arg2 !==
null) {
753 if ($arg3 !==
null) {
756 if ($arg4 !==
null) {
759 if ($arg5 !==
null) {
762 $rawId = $this->_nameInLayout .
'-' . implode(
'-', $args);
763 return trim(preg_replace(
'/[^a-z0-9]+/',
'-', strtolower($rawId)),
'-');
775 return $this->_urlBuilder->getUrl($route,
$params);
789 return $this->_assetRepo->getUrlWithParams($fileId,
$params);
791 $this->_logger->critical($e);
819 $format = \IntlDateFormatter::SHORT,
823 $date = $date instanceof \DateTimeInterface ? $date : new \DateTime($date);
824 return $this->_localeDate->formatDateTime(
827 $showTime ?
$format : \IntlDateFormatter::NONE,
843 $format = \IntlDateFormatter::SHORT,
846 $time = $time instanceof \DateTimeInterface ? $time : new \DateTime($time);
847 return $this->_localeDate->formatDateTime(
849 $showDate ?
$format : \IntlDateFormatter::NONE,
861 if (!$this->
_getData(
'module_name')) {
862 $this->
setData(
'module_name', self::extractModuleName(get_class($this)));
864 return $this->
_getData(
'module_name');
880 return str_replace(
'\\',
'_', $namespace);
892 return $this->_escaper->escapeHtml(
$data, $allowedTags);
904 return $this->_escaper->escapeJs($string);
917 return $this->_escaper->escapeHtmlAttr($string, $escapeSingleQuote);
929 return $this->_escaper->escapeCss($string);
940 public function stripTags(
$data, $allowableTags =
null, $allowHtmlEntities =
false)
942 return $this->filterManager->stripTags(
944 [
'allowableTags' => $allowableTags,
'escape' => $allowHtmlEntities]
956 return $this->_escaper->escapeUrl((
string)$string);
968 return $this->_escaper->escapeXssInUrl(
$data);
983 return $this->_escaper->escapeQuote(
$data, $addSlashes);
996 return $this->_escaper->escapeJsQuote(
$data,
$quote);
1028 if ($this->
hasData(
'cache_key')) {
1029 return static::CACHE_KEY_PREFIX . $this->
getData(
'cache_key');
1038 $key = array_values($key);
1040 $key = implode(
'|', $key);
1042 return static::CACHE_KEY_PREFIX . $key;
1052 if (!$this->
hasData(
'cache_tags')) {
1055 $tags = $this->
getData(
'cache_tags');
1060 $tags = array_merge($tags, $this->getIdentities());
1072 if (!$this->
hasData(
'cache_lifetime')) {
1076 $cacheLifetime = $this->
getData(
'cache_lifetime');
1077 if (
false === $cacheLifetime ||
null === $cacheLifetime) {
1081 return (
int)$cacheLifetime;
1091 if ($this->
getCacheLifetime() ===
null || !$this->_cacheState->isEnabled(self::CACHE_GROUP)) {
1095 $cacheData = $this->_cache->load($cacheKey);
1097 $cacheData = str_replace(
1099 $this->_sidResolver->getSessionIdQueryParam($this->_session) .
'=' . $this->_session->getSessionId(),
1114 if (!$this->
getCacheLifetime() || !$this->_cacheState->isEnabled(self::CACHE_GROUP)) {
1118 $data = str_replace(
1119 $this->_sidResolver->getSessionIdQueryParam($this->_session) .
'=' . $this->_session->getSessionId(),
1136 if ($cacheKey ===
null) {
1140 return '<!--SID=' . $cacheKey .
'-->';
1155 return $this->_viewConfig->getViewConfig()->getVarValue($module,
$name);
getJsId($arg1=null, $arg2=null, $arg3=null, $arg4=null, $arg5=null)
__construct(\Magento\Framework\View\Element\Context $context, array $data=[])
_getSidPlaceholder($cacheKey=null)
getData($key='', $index=null)
append($element, $alias='')
getUiId($arg1=null, $arg2=null, $arg3=null, $arg4=null, $arg5=null)
formatDate( $date=null, $format=\IntlDateFormatter::SHORT, $showTime=false, $timezone=null)
formatTime( $time=null, $format=\IntlDateFormatter::SHORT, $showDate=false)
setLayout(\Magento\Framework\View\LayoutInterface $layout)
stripTags($data, $allowableTags=null, $allowHtmlEntities=false)
setAttribute($name, $value=null)
addChild($alias, $block, $data=[])
getVar($name, $module=null)
_getNotFoundUrl($route='', $params=['_direct'=> 'core/index/notFound'])
escapeJsQuote($data, $quote='\'')
escapeQuote($data, $addSlashes=false)
getGroupChildNames($groupName)
escapeHtml($data, $allowedTags=null)
getUrl($route='', $params=[])
getChildData($alias, $key='')
getChildChildHtml($alias, $childChildAlias='', $useCache=true)
setData($key, $value=null)
escapeHtmlAttr($string, $escapeSingleQuote=true)
insert($element, $siblingName=0, $after=true, $alias='')
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
getChildHtml($alias='', $useCache=true)
static extractModuleName($className)
unsetCallChild($alias, $callback, $result, $params)
getViewFileUrl($fileId, array $params=[])
if(!isset($_GET['name'])) $name