示例#1
0
 public function getTemplatePath(FormItem $item)
 {
     $pseudoClass = $item->getClassName();
     if (isset($this->cache[$pseudoClass])) {
         return $this->cache[$pseudoClass];
     }
     $classHierarchy = self::getClassHierachy($item);
     $itemClass = $classHierarchy[0];
     foreach ($this->paths as $path) {
         // If a custom classname was set, first try a direct hit of it
         if ($itemClass != $pseudoClass) {
             if ($filePath = $this->getExistingPathForClass($path, $pseudoClass)) {
                 $this->cache[$pseudoClass] = $filePath;
                 return $filePath;
             }
         }
         // If not iterate through the class hierarchy from top to bottom
         foreach ($classHierarchy as $class) {
             if ($filePath = $this->getExistingPathForClass($path, $class)) {
                 $this->cache[$pseudoClass] = $filePath;
                 return $filePath;
             }
         }
     }
     // No Exceptions inside __toString
     trigger_error("No template for FormItem '{$pseudoClass}' found", E_USER_ERROR);
 }
示例#2
0
 public function getName()
 {
     if (!$this->name) {
         return self::phpClassNameToCssClassName($this->getClassName());
     }
     return parent::getName();
 }
示例#3
0
 protected function updateAttributes(Attributes $attributes)
 {
     parent::updateAttributes($attributes);
     $attributes['value'] = $this->value;
 }