Nette\Forms\Controls\RadioList::getControlPart PHP Метод

getControlPart() публичный Метод

public getControlPart ( $key = NULL ) : Nette\Utils\Html
Результат Nette\Utils\Html
    public function getControlPart($key = NULL)
    {
        $key = key([(string) $key => NULL]);
        return parent::getControl()->addAttributes(['id' => $this->getHtmlId() . '-' . $key, 'checked' => in_array($key, (array) $this->value, TRUE), 'disabled' => is_array($this->disabled) ? isset($this->disabled[$key]) : $this->disabled, 'value' => $key]);
    }

Usage Example

 /**
  * @internal
  * @param \Nette\Forms\Controls\RadioList $control
  * @return bool
  */
 public static function getRadioListItems(Controls\RadioList $control)
 {
     $items = array();
     foreach ($control->items as $key => $value) {
         $el = $control->getControlPart($key);
         if ($el->getName() === 'input') {
             $items[$key] = $radio = (object) array('input' => $el, 'label' => $cap = $control->getLabelPart($key), 'caption' => $cap->getText());
         } else {
             $items[$key] = $radio = (object) array('input' => $el[0], 'label' => $el[1], 'caption' => $el[1]->getText());
         }
         $radio->label->addClass('radio');
         $radio->html = clone $radio->label;
         $display = $control->getOption('display', 'inline');
         if ($display == 'inline') {
             $radio->html->addClass($display);
         }
         $radio->html->insert(0, $radio->input);
     }
     return $items;
 }
All Usage Examples Of Nette\Forms\Controls\RadioList::getControlPart