Ejemplo n.º 1
0
 /**
  * Find element by path parts
  *
  * @param array $pathParts
  * @return Mage_Backend_Model_Config_Structure_ElementInterface|null
  */
 public function getElementByPathParts(array $pathParts)
 {
     $path = implode('_', $pathParts);
     if (isset($this->_elements[$path])) {
         return $this->_elements[$path];
     }
     $children = $this->_data['sections'];
     $child = array();
     foreach ($pathParts as $pathPart) {
         if (array_key_exists($pathPart, $children)) {
             $child = $children[$pathPart];
             $children = array_key_exists('children', $child) ? $child['children'] : array();
         } else {
             $child = $this->_createEmptyElement($pathParts);
             break;
         }
     }
     $this->_elements[$path] = $this->_flyweightFactory->create($child['_elementType']);
     $this->_elements[$path]->setData($child, $this->_scopeDefiner->getScope());
     return $this->_elements[$path];
 }
Ejemplo n.º 2
0
 public function testGetScopeReturnsWebsiteScopeIfWebsiteIsSpecified()
 {
     $this->_requestMock->expects($this->any())->method('getParam')->will($this->returnValueMap(array(array('website', null, 'someWebsite'), array('store', null, null))));
     $this->assertEquals(Mage_Backend_Model_Config_ScopeDefiner::SCOPE_WEBSITE, $this->_model->getScope());
 }