Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/Ecombricks/Inventory/Framework/View/Layout/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/corals/Ecombricks/Inventory/Framework/View/Layout/RenderElementTrait.php
<?php
/**
 * Copyright © eComBricks. All rights reserved.
 * See LICENSE.txt for license details.
 */
namespace Ecombricks\Inventory\Framework\View\Layout;

/**
 * Layout render element trait
 */
trait RenderElementTrait
{
    
    /**
     * Render container
     * 
     * @param string $name
     * @param boolean $useCache
     * @return string
     */
    protected function inventoryRenderContainer($name, $useCache = true)
    {
        $html = '';
        $children = $this->getChildNames($name);
        foreach ($children as $child) {
            $html .= $this->renderElement($child, $useCache);
        }
        if ($html == '' || !$this->structure->getAttribute($name, \Magento\Framework\View\Layout\Element::CONTAINER_OPT_HTML_TAG)) {
            return $html;
        }
        $htmlId = $this->structure->getAttribute($name, \Magento\Framework\View\Layout\Element::CONTAINER_OPT_HTML_ID);
        if ($htmlId) {
            $htmlId = ' id="' . $htmlId . '"';
        }
        $htmlClass = $this->structure->getAttribute($name, \Magento\Framework\View\Layout\Element::CONTAINER_OPT_HTML_CLASS);
        if ($htmlClass) {
            $htmlClass = ' class="' . $htmlClass . '"';
        }
        $htmlTag = $this->structure->getAttribute($name, \Magento\Framework\View\Layout\Element::CONTAINER_OPT_HTML_TAG);
        $html = sprintf('<%1$s%2$s%3$s>%4$s</%1$s>', $htmlTag, $htmlId, $htmlClass, $html);
        return $html;
    }
    
    /**
     * Render non cached element
     * 
     * @param string $name
     * @param boolean $useCache
     * @return string
     * @throws \Exception
     */
    protected function inventoryRenderNonCachedElement($name, $useCache = true)
    {
        $result = '';
        try {
            if ($this->isUiComponent($name)) {
                $result = $this->_renderUiComponent($name);
            } elseif ($this->isBlock($name)) {
                $result = $this->_renderBlock($name);
            } else {
                $result = $this->inventoryRenderContainer($name, $useCache);
            }
        } catch (\Exception $exception) {
            if ($this->appState->getMode() === \Magento\Framework\App\State::MODE_DEVELOPER) {
                throw $exception;
            }
            $message = ($exception instanceof \Magento\Framework\Exception\LocalizedException) ? 
                $exception->getLogMessage() : 
                $exception->getMessage();
            $this->logger->critical($message);
        }
        return $result;
    }
    
    /**
     * Render element
     *
     * @param string $name
     * @param boolean $useCache
     * @return string
     */
    public function inventoryRenderElement($name, $useCache = true)
    {
        $this->build();
        if (!isset($this->_renderElementCache[$name]) || !$useCache) {
            if ($this->displayElement($name)) {
                $this->_renderElementCache[$name] = $this->inventoryRenderNonCachedElement($name, $useCache);
            } else {
                return $this->_renderElementCache[$name] = '';
            }
        }
        $this->_renderingOutput->setData('output', $this->_renderElementCache[$name]);
        $this->_eventManager->dispatch(
            'core_layout_render_element',
            [
                'element_name' => $name,
                'layout' => $this,
                'transport' => $this->_renderingOutput
            ]
        );
        return $this->_renderingOutput->getData('output');
    }
    
}

Spamworldpro Mini