Exemple #1
0
    /**
     * Get all meta data from a certain panel
     * @return array
     */
    public function get($panel)
    {
       if (!is_file(Shopware()->DocPath()."/files/config/Panels.xml")) {
            return false;
       }

       $xml = new Shopware_Components_Xml_SimpleXml();
       $xml->loadFile(Shopware()->DocPath()."/files/config/Panels.xml");
       $xpath = '//Panel[@name="'.$panel.'"]';

       $WidgetMainNode = $xml->SimpleXML->firstOf($xpath);
       if (!$WidgetMainNode) {
           throw new Enlight_Exception("Panel $panel not found");
       }
       $result = $xml->nodeToArray($WidgetMainNode);
       return $result;
    }
Exemple #2
0
    /**
     * Get a certain widget from configuration
     * @throws Enlight_Exception
     * @param  $name
     * @return string
     */
    public function get($name)
    {
        if (empty($this->widgetXML)) {
            throw new Enlight_Exception("\$this->panel can not be null");
        }
        $XML = new Shopware_Components_Xml_SimpleXml();
        $XML->loadFile($this->widgetXML);
        $widget = $XML->SimpleXML->firstOf('//Widget[@name="'.$name.'"]');

        $widget = $XML->nodeToArray($widget);
        return $widget;
    }