Beispiel #1
0
 public function getForm($nodeId, $scopes = array())
 {
     $tag = new Tag($this->getDataSource());
     $tag->loadById((int) $nodeId);
     $values = $tag->getInheritedAttributesValues();
     //on supprime les valeurs d'attribut non définies par le type. Comportement propre à la gestion des tags
     $attributes = $tag->getInheritableAttributes();
     foreach ($values['attributes'] as $name => $attribute) {
         if (!isset($attributes['attributes'][$name])) {
             unset($values['attributes'][$name]);
         }
     }
     $inputs = array();
     $scopes = array('system');
     foreach ($values['attributes'] as $name => &$attribute) {
         if (isset($attribute['scopes']) && !empty($attribute['scopes'])) {
             $validatedScopes = array_intersect($attribute['scopes'], $scopes);
             if (empty($validatedScopes)) {
                 continue;
             }
         }
         $renderer = new AttributeRenderer($name, $attribute);
         $inputs[$name] = $renderer->toWebComponent('pmd-form');
     }
     return $inputs;
 }