Example #1
0
 /**
  * Init current element
  *
  * @param array $element
  * @throws LogicException
  */
 protected function _initFlyweight(array $element)
 {
     if (!isset($element[Mage_Backend_Model_Config_Structure::TYPE_KEY])) {
         throw new LogicException('System config structure element must contain "type" attribute');
     }
     switch ($element[Mage_Backend_Model_Config_Structure::TYPE_KEY]) {
         case 'group':
             $this->_flyweight = $this->_groupFlyweight;
             break;
         case 'field':
         default:
             $this->_flyweight = $this->_fieldFlyweight;
     }
     parent::_initFlyweight($element);
 }
Example #2
0
 /**
  * @param Mage_Backend_Model_Config_Structure_Element_Tab $element
  */
 public function __construct(Mage_Backend_Model_Config_Structure_Element_Tab $element)
 {
     parent::__construct($element);
 }
Example #3
0
 /**
  * @param string $elementId
  * @param bool $result
  * @dataProvider isLastDataProvider
  */
 public function testIsLast($elementId, $result)
 {
     $elementMock = $this->getMock('Mage_Backend_Model_Config_Structure_Element_Field', array(), array(), '', false);
     $elementMock->expects($this->once())->method('getId')->will($this->returnValue($elementId));
     $this->assertEquals($result, $this->_model->isLast($elementMock));
 }
Example #4
0
 /**
  * Set flyweight data
  *
  * @param array $data
  * @param string $scope
  */
 public function setData(array $data, $scope)
 {
     parent::setData($data, $scope);
     $children = array_key_exists('children', $this->_data) && is_array($this->_data['children']) ? $this->_data['children'] : array();
     $this->_childrenIterator->setElements($children, $scope);
 }