setAttribute() public method

Changes control's HTML attribute.
public setAttribute ( $name, $value = TRUE ) : self
return self
Beispiel #1
0
 /**
  * @param Nette\Forms\Controls\BaseControl $input
  * @return Nette\Forms\Controls\BaseControl
  */
 protected function addAttributes($input)
 {
     if ($this->grid->hasAutoSubmit()) {
         $input->setAttribute('data-autosubmit', TRUE);
     } else {
         $input->setAttribute('data-datagrid-manualsubmit', TRUE);
     }
     foreach ($this->attributes as $attribute) {
         $input->setAttribute($attribute[0], $attribute[1]);
     }
     return $input;
 }
Beispiel #2
0
 /**
  * @param Nette\Forms\Controls\BaseControl $control
  * @param array                            $options
  */
 public function applyUserOptions($control, array $options)
 {
     $class = isset($options['class']) ? $options['class'] : NULL;
     $label = isset($options['label']) ? $options['label'] : NULL;
     if (!is_null($class)) {
         $control->setAttribute('class', $class);
     }
     if (!is_null($label)) {
         $control->caption = $label;
     }
     //$this->setRules($input, $validate);
 }