Esempio n. 1
0
 /**
  * @param FormObjectInterface $object
  *
  * @return mixed
  */
 public function attributes(FormObjectInterface $object)
 {
     $renderer = new AttributeRenderer();
     $name = new KeyValuePair('name', $object->getFullName());
     $attrs = [$renderer->render($name)];
     foreach ($object->attributes() as $attr) {
         $attrs[] = $renderer->render($attr);
     }
     return implode(' ', $attrs);
 }
Esempio n. 2
0
 public function renderOptionAttributes(Field\ListField $field)
 {
     $renderer = new AttributeRenderer();
     $asArray = '';
     $type = '';
     if ($field instanceof Field\CheckBoxSet) {
         $type = 'checkbox';
         $asArray = '[]';
     } elseif ($field instanceof Field\RadioSet) {
         $type = 'radio';
     }
     $type = new KeyValuePair('type', $type);
     $name = new KeyValuePair('name', $field->getFullName() . $asArray);
     $attrs = [$renderer->render($type), $renderer->render($name)];
     foreach ($field->attributes() as $attr) {
         $attrs[] = $renderer->render($attr);
     }
     return implode(' ', $attrs);
 }