Пример #1
0
 protected function _renderAttributes(Form $form, array $custom = null)
 {
     $attributes = ["class" => "packaged-form", "method" => $form->getOption('method', 'post'), "action" => $form->getOption('action', ''), "name" => $form->getOption('name'), "id" => $form->getId()];
     $attributes = array_merge($attributes, (array) $custom, (array) $form->getAttributes());
     $return = '';
     foreach ($attributes as $k => $v) {
         $return .= $v === null ? " {$k}" : " {$k}=\"{$v}\"";
     }
     return $return;
 }
Пример #2
0
 public function __construct(Form $form, $name, $type = self::TEXT, $label = null, $labelPosition = self::LABEL_BEFORE)
 {
     $name = Strings::stringToUnderScore($name);
     $this->_name = $name;
     $this->_id = $form->getId() . '-' . Strings::urlize($name);
     $this->setOption('name', $name);
     $this->setOption('id', $this->_id);
     $this->_type = $type;
     $this->_label = $label === null ? Strings::humanize($name) : $label;
     $this->_labelPosition = $labelPosition;
     $this->_form = $form;
 }