示例#1
0
 public function testGetWidgetsArray()
 {
     $declaredWidgets = $this->_model->getWidgetsArray();
     $this->assertNotEmpty($declaredWidgets);
     $this->assertInternalType('array', $declaredWidgets);
     foreach ($declaredWidgets as $row) {
         $this->assertArrayHasKey('name', $row);
         $this->assertArrayHasKey('code', $row);
         $this->assertArrayHasKey('type', $row);
         $this->assertArrayHasKey('description', $row);
     }
 }
示例#2
0
 /**
  * @return array
  */
 public function widgetPlaceholderImagesDataProvider()
 {
     $result = array();
     $model = new Mage_Widget_Model_Widget();
     foreach ($model->getWidgetsArray() as $row) {
         $instance = new Mage_Widget_Model_Widget_Instance();
         $config = $instance->setType($row['type'])->getWidgetConfig();
         // @codingStandardsIgnoreStart
         if (isset($config->placeholder_image)) {
             $result[] = array((string) $config->placeholder_image);
         }
         // @codingStandardsIgnoreEnd
     }
     return $result;
 }
示例#3
0
 /**
  * Collect all declared widget blocks and templates
  *
  * @return array
  */
 public function widgetTemplatesDataProvider()
 {
     $result = array();
     $model = new Mage_Widget_Model_Widget();
     foreach ($model->getWidgetsArray() as $row) {
         $instance = new Mage_Widget_Model_Widget_Instance();
         $config = $instance->setType($row['type'])->getWidgetConfig();
         $class = Mage::getConfig()->getBlockClassName($row['type']);
         if (is_subclass_of($class, 'Mage_Core_Block_Template')) {
             $templates = $config->xpath('/widgets/' . $row['code'] . '/parameters/template/values/*/value');
             foreach ($templates as $template) {
                 $result[] = array($class, (string) $template);
             }
         }
     }
     return $result;
 }
示例#4
0
 public function getTabsArray($filters = array())
 {
     return parent::getWidgetsArray($filters);
 }