예제 #1
0
 /**
  * @param string $name
  * @return BlockProperty
  */
 public function getProperty($name)
 {
     $propertyConfig = $this->config->getProperty($name);
     $property = null;
     foreach ($this->properties as $candidate) {
         //			$configMatches = $propertyConfig->isMatchingProperty($candidate);
         $nameMatches = $name == $candidate->getHierarchicalName();
         // @TODO: dev
         if ($nameMatches) {
             $property = $candidate;
             break;
         }
     }
     if ($property === null) {
         $parentProperty = null;
         if ($propertyConfig->hasParent()) {
             $dotPos = strrpos($name, '.');
             $parentName = substr($name, 0, $dotPos);
             $name = substr($name, $dotPos + 1);
             $parentProperty = $this->getProperty($parentName);
         }
         $property = $propertyConfig->createProperty($name);
         $property->setBlock($this->block);
         $property->setLocalization($this->getRequest()->getLocalization());
         if ($parentProperty) {
             $parentProperty->addProperty($property);
         }
         $this->properties->append($property);
     }
     return $property;
 }
예제 #2
0
 /**
  * @TODO: maybe optimize by grouping the properties once
  *
  * @param Block $block
  * @return BlockPropertySet
  */
 public function getBlockPropertySet(Block $block)
 {
     $blockPropertySet = new BlockPropertySet();
     /* @var $blockProperty \Supra\Package\Cms\Entity\BlockProperty */
     foreach ($this as $blockProperty) {
         if ($blockProperty->getBlock()->equals($block)) {
             $blockPropertySet->append($blockProperty);
         }
     }
     return $blockPropertySet;
 }