Final Class Yiisoft\Form\Field\RadioList
See also \Yiisoft\Html\Widget\RadioList\RadioList.
Protected Properties
Public Methods
Protected Methods
Constants
| Constant | Value | Description | Defined By |
|---|---|---|---|
| BUILTIN_TOKENS | [ '{input}', '{label}', '{hint}', '{error}', ] | Yiisoft\Form\Field\Base\PartsField |
Method Details
| public mixed __construct ( ) |
public function __construct()
{
$this->widget = RadioListWidget::create('');
}
| public Yiisoft\Form\Field\RadioList addContainerAttributes ( array $attributes ) | ||
| $attributes | array | |
final public function addContainerAttributes(array $attributes): static
{
$new = clone $this;
$new->containerAttributes = array_merge($new->containerAttributes, $attributes);
return $new;
}
Defined in: Yiisoft\Form\Field\Base\BaseField::addContainerClass()
Add one or more CSS classes to the container tag.
| public Yiisoft\Form\Field\RadioList addContainerClass ( string|null $class ) | ||
| $class | string|null |
One or many CSS classes. |
final public function addContainerClass(?string ...$class): static
{
$new = clone $this;
Html::addCssClass($new->containerAttributes, $class);
return $new;
}
| public Yiisoft\Form\Field\RadioList addErrorAttributes ( array $attributes ) | ||
| $attributes | array | |
final public function addErrorAttributes(array $attributes): static
{
$new = clone $this;
$new->errorAttributes = array_merge($new->errorAttributes, $attributes);
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::addErrorClass()
Add one or more CSS classes to the error tag.
| public Yiisoft\Form\Field\RadioList addErrorClass ( string|null $class ) | ||
| $class | string|null |
One or many CSS classes. |
final public function addErrorClass(?string ...$class): static
{
$new = clone $this;
Html::addCssClass($new->errorAttributes, $class);
return $new;
}
| public Yiisoft\Form\Field\RadioList addHintAttributes ( array $attributes ) | ||
| $attributes | array | |
final public function addHintAttributes(array $attributes): static
{
$new = clone $this;
$new->hintAttributes = array_merge($new->hintAttributes, $attributes);
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::addHintClass()
Add one or more CSS classes to the hint tag.
| public Yiisoft\Form\Field\RadioList addHintClass ( string|null $class ) | ||
| $class | string|null |
One or many CSS classes. |
final public function addHintClass(?string ...$class): static
{
$new = clone $this;
Html::addCssClass($new->hintAttributes, $class);
return $new;
}
| public self addIndividualInputAttributes ( array[] $attributes ) | ||
| $attributes | array[] | |
public function addIndividualInputAttributes(array $attributes): self
{
$new = clone $this;
$new->widget = $this->widget->addIndividualInputAttributes($attributes);
return $new;
}
| public Yiisoft\Form\Field\RadioList addInputContainerAttributes ( array $attributes ) | ||
| $attributes | array | |
final public function addInputContainerAttributes(array $attributes): static
{
$new = clone $this;
$new->inputContainerAttributes = array_merge($new->inputContainerAttributes, $attributes);
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::addInputContainerClass()
Add one or more CSS classes to the input container tag.
| public Yiisoft\Form\Field\RadioList addInputContainerClass ( string|null $class ) | ||
| $class | string|null |
One or many CSS classes. |
final public function addInputContainerClass(?string ...$class): static
{
$new = clone $this;
Html::addCssClass($new->inputContainerAttributes, $class);
return $new;
}
Defined in: Yiisoft\Form\Field\Base\ValidationClass\ValidationClassTrait::addInputValidationClassToAttributes()
| protected void addInputValidationClassToAttributes ( array &$attributes, Yiisoft\Form\Field\Base\InputData\InputDataInterface $inputData, boolean|null $hasCustomError = null ) | ||
| $attributes | array | |
| $inputData | Yiisoft\Form\Field\Base\InputData\InputDataInterface | |
| $hasCustomError | boolean|null | |
protected function addInputValidationClassToAttributes(
array &$attributes,
InputDataInterface $inputData,
?bool $hasCustomError = null,
): void {
$this->addClassesToAttributes(
$attributes,
$inputData,
$hasCustomError,
$this->inputInvalidClass,
$this->inputValidClass,
);
}
| public Yiisoft\Form\Field\RadioList addLabelAttributes ( array $attributes ) | ||
| $attributes | array | |
final public function addLabelAttributes(array $attributes): static
{
$new = clone $this;
$new->labelAttributes = array_merge($new->labelAttributes, $attributes);
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::addLabelClass()
Add one or more CSS classes to the label tag.
| public Yiisoft\Form\Field\RadioList addLabelClass ( string|null $class ) | ||
| $class | string|null |
One or many CSS classes. |
final public function addLabelClass(?string ...$class): static
{
$new = clone $this;
Html::addCssClass($new->labelAttributes, $class);
return $new;
}
| public self addRadioAttributes ( array $attributes ) | ||
| $attributes | array | |
public function addRadioAttributes(array $attributes): self
{
$new = clone $this;
$new->radioAttributes = array_merge($new->radioAttributes, $attributes);
return $new;
}
| public self addRadioLabelAttributes ( array $attributes ) | ||
| $attributes | array | |
public function addRadioLabelAttributes(array $attributes): self
{
$new = clone $this;
$new->widget = $this->widget->addRadioLabelAttributes($attributes);
return $new;
}
| public self addRadioWrapClass ( string|null $class ) | ||
| $class | string|null | |
public function addRadioWrapClass(?string ...$class): self
{
$new = clone $this;
$new->widget = $this->widget->addRadioWrapClass(...$class);
return $new;
}
Defined in: Yiisoft\Form\Field\Base\ValidationClass\ValidationClassTrait::addValidationClassToAttributes()
| protected void addValidationClassToAttributes ( array &$attributes, Yiisoft\Form\Field\Base\InputData\InputDataInterface $inputData, boolean|null $hasCustomError = null ) | ||
| $attributes | array | |
| $inputData | Yiisoft\Form\Field\Base\InputData\InputDataInterface | |
| $hasCustomError | boolean|null | |
protected function addValidationClassToAttributes(
array &$attributes,
InputDataInterface $inputData,
?bool $hasCustomError = null,
): void {
$this->addClassesToAttributes(
$attributes,
$inputData,
$hasCustomError,
$this->invalidClass,
$this->validClass,
);
}
Defined in: Yiisoft\Form\Field\Base\PartsField::afterInput()
| public Yiisoft\Form\Field\RadioList afterInput ( string|\Stringable $content ) | ||
| $content | string|\Stringable | |
final public function afterInput(string|Stringable $content): static
{
$new = clone $this;
$new->afterInput = $content;
return $new;
}
| public Yiisoft\Form\Field\RadioList beforeInput ( string|\Stringable $content ) | ||
| $content | string|\Stringable | |
final public function beforeInput(string|Stringable $content): static
{
$new = clone $this;
$new->beforeInput = $content;
return $new;
}
| protected void beforeRender ( ) |
protected function beforeRender(): void
{
}
Defined in: Yiisoft\Form\Field\Base\BaseField::begin()
| public string|null begin ( ) |
final public function begin(): ?string
{
parent::begin();
$this->isStartedByBegin = true;
$this->beforeRender();
$content = $this->generateBeginContent();
return $this->renderOpenContainerAndContent($content);
}
| public Yiisoft\Form\Field\RadioList containerAttributes ( array $attributes ) | ||
| $attributes | array | |
final public function containerAttributes(array $attributes): static
{
$new = clone $this;
$new->containerAttributes = $attributes;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\BaseField::containerClass()
Replace container tag CSS classes with a new set of classes.
| public Yiisoft\Form\Field\RadioList containerClass ( string|null $class ) | ||
| $class | string|null |
One or many CSS classes. |
final public function containerClass(?string ...$class): static
{
$new = clone $this;
$new->containerAttributes['class'] = array_filter($class, static fn ($c) => $c !== null);
return $new;
}
Defined in: Yiisoft\Form\Field\Base\BaseField::containerId()
Set container tag ID.
| public Yiisoft\Form\Field\RadioList containerId ( string|null $id ) | ||
| $id | string|null |
Container tag ID. |
final public function containerId(?string $id): static
{
$new = clone $this;
$new->containerAttributes['id'] = $id;
return $new;
}
| public Yiisoft\Form\Field\RadioList containerTag ( string $tag ) | ||
| $tag | string | |
final public function containerTag(string $tag): static
{
if ($tag === '') {
throw new InvalidArgumentException('Tag name cannot be empty.');
}
$new = clone $this;
$new->containerTag = $tag;
return $new;
}
| public self disabled ( boolean $disabled = true ) | ||
| $disabled | boolean |
Whether radio buttons is disabled. |
public function disabled(bool $disabled = true): self
{
$new = clone $this;
$new->widget = $this->widget->disabled($disabled);
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::error()
| public Yiisoft\Form\Field\RadioList error ( string|null $message, string $messages ) | ||
| $message | string|null | |
| $messages | string | |
final public function error(?string $message, string ...$messages): static
{
$new = clone $this;
$new->errorConfig['message()'] = [$message, ...$messages];
return $new;
}
| public Yiisoft\Form\Field\RadioList errorAttributes ( array $attributes ) | ||
| $attributes | array | |
final public function errorAttributes(array $attributes): static
{
$new = clone $this;
$new->errorAttributes = $attributes;
$new->replaceErrorAttributes = true;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::errorClass()
Replace error tag CSS classes with a new set of classes.
| public Yiisoft\Form\Field\RadioList errorClass ( string|null $class ) | ||
| $class | string|null |
One or many CSS classes. |
final public function errorClass(?string ...$class): static
{
$new = clone $this;
$new->errorAttributes['class'] = $class;
$new->replaceErrorClass = true;
return $new;
}
| public Yiisoft\Form\Field\RadioList errorConfig ( array $config ) | ||
| $config | array | |
final public function errorConfig(array $config): static
{
$new = clone $this;
$new->errorConfig = $config;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::errorId()
Set error tag ID.
| public Yiisoft\Form\Field\RadioList errorId ( string|null $id ) | ||
| $id | string|null |
Error tag ID. |
final public function errorId(?string $id): static
{
$new = clone $this;
$new->errorAttributes['id'] = $id;
return $new;
}
Specifies the form element the tag input element belongs to. The value of this attribute must be the ID attribute of a form element in the same document.
| public self form ( string|null $formId ) | ||
| $formId | string|null | |
public function form(?string $formId): self
{
$new = clone $this;
$new->widget = $this->widget->form($formId);
return $new;
}
| protected string generateBeginContent ( ) |
final protected function generateBeginContent(): string
{
$parts = [
'{input}' => $this->generateBeginInput(),
'{label}' => ($this->hideLabel ?? $this->shouldHideLabel()) ? '' : $this->generateLabel(),
'{hint}' => $this->generateHint(),
'{error}' => $this->generateError(),
];
return $this->makeContent($this->templateBegin, $parts);
}
| protected string generateBeginInput ( ) |
protected function generateBeginInput(): string
{
return '';
}
| protected string|null generateContent ( ) |
final protected function generateContent(): ?string
{
$parts = [
'{input}' => $this->generateInputContainerBegin()
. $this->beforeInput
. $this->generateInput()
. $this->afterInput
. $this->generateInputContainerEnd(),
'{label}' => ($this->hideLabel ?? $this->shouldHideLabel()) ? '' : $this->generateLabel(),
'{hint}' => $this->generateHint(),
'{error}' => $this->generateError(),
];
return $this->makeContent($this->template, $parts);
}
| protected string generateEndContent ( ) |
final protected function generateEndContent(): string
{
$parts = [
'{input}' => $this->generateEndInput(),
'{label}' => ($this->hideLabel ?? $this->shouldHideLabel()) ? '' : $this->generateLabel(),
'{hint}' => $this->generateHint(),
'{error}' => $this->generateError(),
];
return $this->makeContent($this->templateEnd, $parts);
}
| protected string generateEndInput ( ) |
protected function generateEndInput(): string
{
return '';
}
| protected string generateInput ( ) |
protected function generateInput(): string
{
$name = $this->getName();
if (empty($name)) {
throw new LogicException('"RadioList" field requires non-empty name.');
}
$value = $this->getValue();
if (
!is_bool($value)
&& !is_string($value)
&& !$value instanceof Stringable
&& !is_numeric($value)
&& $value !== null
) {
throw new InvalidArgumentException(
'"RadioList" field requires a string, Stringable, numeric, bool or null value.'
);
}
/** @psalm-var Stringable|scalar $value */
$radioAttributes = $this->radioAttributes;
$this->addInputValidationClassToAttributes(
$radioAttributes,
$this->getInputData(),
$this->hasCustomError() ? true : null,
);
return $this->widget
->name($name)
->value($value)
->addRadioAttributes($radioAttributes)
->render();
}
| protected Yiisoft\Form\Field\Base\InputData\InputDataInterface getInputData ( ) |
final protected function getInputData(): InputDataInterface
{
if ($this->inputData === null) {
$this->inputData = new InputData();
}
return $this->inputData;
}
| protected string|null getName ( ) |
final protected function getName(): ?string
{
return $this->useCustomName
? $this->customName
: $this->getInputData()->getName();
}
| protected static array getThemeConfig ( string|null $theme ) | ||
| $theme | string|null | |
final protected static function getThemeConfig(?string $theme): array
{
return ThemeContainer::getTheme($theme)?->getFieldConfig(static::class) ?? [];
}
| protected mixed getValue ( ) |
final protected function getValue(): mixed
{
$value = $this->useCustomValue
? $this->customValue
: $this->getInputData()->getValue();
return $this->prepareValueCallback === null
? $value
: ($this->prepareValueCallback)($value);
}
| protected boolean hasCustomError ( ) |
final protected function hasCustomError(): bool
{
return isset($this->errorConfig['message()']);
}
Defined in: Yiisoft\Form\Field\Base\PartsField::hideLabel()
| public Yiisoft\Form\Field\RadioList hideLabel ( boolean|null $hide = true ) | ||
| $hide | boolean|null | |
final public function hideLabel(?bool $hide = true): static
{
$new = clone $this;
$new->hideLabel = $hide;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::hint()
| public Yiisoft\Form\Field\RadioList hint ( string|null $content ) | ||
| $content | string|null | |
final public function hint(?string $content): static
{
$new = clone $this;
$new->hintConfig['content()'] = [$content];
return $new;
}
| public Yiisoft\Form\Field\RadioList hintAttributes ( array $attributes ) | ||
| $attributes | array | |
final public function hintAttributes(array $attributes): static
{
$new = clone $this;
$new->hintAttributes = $attributes;
$new->replaceHintAttributes = true;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::hintClass()
Replace hint tag CSS classes with a new set of classes.
| public Yiisoft\Form\Field\RadioList hintClass ( string|null $class ) | ||
| $class | string|null |
One or many CSS classes. |
final public function hintClass(?string ...$class): static
{
$new = clone $this;
$new->hintAttributes['class'] = $class;
$new->replaceHintClass = true;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::hintConfig()
| public Yiisoft\Form\Field\RadioList hintConfig ( array $config ) | ||
| $config | array | |
final public function hintConfig(array $config): static
{
$new = clone $this;
$new->hintConfig = $config;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::hintId()
Set hint tag ID.
| public Yiisoft\Form\Field\RadioList hintId ( string|null $id ) | ||
| $id | string|null |
Hint tag ID. |
final public function hintId(?string $id): static
{
$new = clone $this;
$new->hintAttributes['id'] = $id;
return $new;
}
| public self individualInputAttributes ( array[] $attributes ) | ||
| $attributes | array[] | |
public function individualInputAttributes(array $attributes): self
{
$new = clone $this;
$new->widget = $this->widget->individualInputAttributes($attributes);
return $new;
}
| public Yiisoft\Form\Field\RadioList inputContainerAttributes ( array $attributes ) | ||
| $attributes | array | |
final public function inputContainerAttributes(array $attributes): static
{
$new = clone $this;
$new->inputContainerAttributes = $attributes;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::inputContainerClass()
Replace input container tag CSS classes with a new set of classes.
| public Yiisoft\Form\Field\RadioList inputContainerClass ( string|null $class ) | ||
| $class | string|null |
One or many CSS classes. |
final public function inputContainerClass(?string ...$class): static
{
$new = clone $this;
$new->inputContainerAttributes['class'] = array_filter($class, static fn ($c) => $c !== null);
return $new;
}
| public Yiisoft\Form\Field\RadioList inputContainerTag ( string|null $tag ) | ||
| $tag | string|null | |
final public function inputContainerTag(?string $tag): static
{
if ($tag === '') {
throw new InvalidArgumentException('Tag name cannot be empty.');
}
$new = clone $this;
$new->inputContainerTag = $tag;
return $new;
}
| public Yiisoft\Form\Field\RadioList inputData ( Yiisoft\Form\Field\Base\InputData\InputDataInterface $inputData ) | ||
| $inputData | Yiisoft\Form\Field\Base\InputData\InputDataInterface | |
final public function inputData(InputDataInterface $inputData): static
{
$new = clone $this;
$new->inputData = $inputData;
$new->useCustomName = false;
$new->useCustomValue = false;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\ValidationClass\ValidationClassTrait::inputInvalidClass()
Set invalid CSS class for input tag.
| public self inputInvalidClass ( string|null $class ) | ||
| $class | string|null | |
public function inputInvalidClass(?string $class): self
{
$new = clone $this;
$new->inputInvalidClass = $class;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\ValidationClass\ValidationClassTrait::inputValidClass()
Set valid CSS class for input tag.
| public self inputValidClass ( string|null $class ) | ||
| $class | string|null | |
public function inputValidClass(?string $class): self
{
$new = clone $this;
$new->inputValidClass = $class;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\ValidationClass\ValidationClassTrait::invalidClass()
Set invalid CSS class.
| public self invalidClass ( string|null $class ) | ||
| $class | string|null | |
public function invalidClass(?string $class): self
{
$new = clone $this;
$new->invalidClass = $class;
return $new;
}
| public self itemFormatter ( Closure|null $formatter ) | ||
| $formatter | Closure|null | |
public function itemFormatter(?Closure $formatter): self
{
$new = clone $this;
$new->widget = $this->widget->itemFormatter($formatter);
return $new;
}
| public self items ( string[] $items, boolean $encodeLabels = true ) | ||
| $items | string[] | |
| $encodeLabels | boolean |
Whether labels should be encoded. |
public function items(array $items, bool $encodeLabels = true): self
{
$new = clone $this;
$new->widget = $this->widget->items($items, $encodeLabels);
return $new;
}
Fills items from an array provided. Array values are used for both input labels and input values.
| public self itemsFromValues ( boolean[]|float[]|integer[]|string[]|\Stringable[] $values, boolean $encodeLabels = true ) | ||
| $values | boolean[]|float[]|integer[]|string[]|\Stringable[] | |
| $encodeLabels | boolean |
Whether labels should be encoded. |
public function itemsFromValues(array $values, bool $encodeLabels = true): self
{
$new = clone $this;
$new->widget = $this->widget->itemsFromValues($values, $encodeLabels);
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::label()
| public Yiisoft\Form\Field\RadioList label ( string|null $content ) | ||
| $content | string|null | |
final public function label(?string $content): static
{
$new = clone $this;
$new->label = $content;
return $new;
}
| public Yiisoft\Form\Field\RadioList labelAttributes ( array $attributes ) | ||
| $attributes | array | |
final public function labelAttributes(array $attributes): static
{
$new = clone $this;
$new->labelAttributes = $attributes;
$new->replaceLabelAttributes = true;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::labelClass()
Replace label tag CSS classes with a new set of classes.
| public Yiisoft\Form\Field\RadioList labelClass ( string|null $class ) | ||
| $class | string|null |
One or many CSS classes. |
final public function labelClass(?string ...$class): static
{
$new = clone $this;
$new->labelAttributes['class'] = $class;
$new->replaceLabelClass = true;
return $new;
}
| public Yiisoft\Form\Field\RadioList labelConfig ( array $config ) | ||
| $config | array | |
final public function labelConfig(array $config): static
{
$new = clone $this;
$new->labelConfig = $config;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::labelId()
Set label tag ID.
| public Yiisoft\Form\Field\RadioList labelId ( string|null $id ) | ||
| $id | string|null |
Label tag ID. |
final public function labelId(?string $id): static
{
$new = clone $this;
$new->labelAttributes['id'] = $id;
return $new;
}
| public Yiisoft\Form\Field\RadioList name ( string|null $name ) | ||
| $name | string|null | |
final public function name(?string $name): static
{
$new = clone $this;
$new->customName = $name;
$new->useCustomName = true;
return $new;
}
| protected void prepareContainerAttributes ( array &$attributes ) | ||
| $attributes | array | |
protected function prepareContainerAttributes(array &$attributes): void
{
$this->addValidationClassToAttributes(
$attributes,
$this->getInputData(),
$this->hasCustomError() ? true : null,
);
}
| public Yiisoft\Form\Field\RadioList prepareValue ( callable|null $callback ) | ||
| $callback | callable|null | |
final public function prepareValue(?callable $callback): static
{
$new = clone $this;
$new->prepareValueCallback = $callback;
return $new;
}
| public self radioAttributes ( array $attributes ) | ||
| $attributes | array | |
public function radioAttributes(array $attributes): self
{
$new = clone $this;
$new->radioAttributes = $attributes;
return $new;
}
| public self radioLabelAttributes ( array $attributes ) | ||
| $attributes | array | |
public function radioLabelAttributes(array $attributes): self
{
$new = clone $this;
$new->widget = $this->widget->radioLabelAttributes($attributes);
return $new;
}
| public self radioLabelWrap ( boolean $wrap ) | ||
| $wrap | boolean | |
public function radioLabelWrap(bool $wrap): self
{
$new = clone $this;
$new->widget = $this->widget->radioLabelWrap($wrap);
return $new;
}
| public self radioWrapAttributes ( array $attributes ) | ||
| $attributes | array | |
public function radioWrapAttributes(array $attributes): self
{
$new = clone $this;
$new->widget = $this->widget->radioWrapAttributes($attributes);
return $new;
}
| public self radioWrapClass ( string|null $class ) | ||
| $class | string|null | |
public function radioWrapClass(?string ...$class): self
{
$new = clone $this;
$new->widget = $this->widget->radioWrapClass(...$class);
return $new;
}
| public self radioWrapTag ( string|null $name ) | ||
| $name | string|null | |
public function radioWrapTag(?string $name): self
{
$new = clone $this;
$new->widget = $this->widget->radioWrapTag($name);
return $new;
}
Defined in: Yiisoft\Form\Field\Base\BaseField::render()
| public string render ( ) |
final public function render(): string
{
if ($this->isStartedByBegin) {
$this->isStartedByBegin = false;
return $this->renderEnd();
}
$this->beforeRender();
$content = $this->generateContent();
if ($content === null) {
$this->enrichment = [];
return '';
}
$result = $this->renderOpenContainerAndContent($content);
if ($this->useContainer) {
$result .= "\n" . Html::closeTag($this->containerTag);
}
$this->enrichment = [];
return $result;
}
| protected string renderError ( Yiisoft\Form\Field\Part\Error $error ) | ||
| $error | Yiisoft\Form\Field\Part\Error | |
protected function renderError(Error $error): string
{
return $error
->inputData($this->getInputData())
->render();
}
| protected string renderHint ( Yiisoft\Form\Field\Part\Hint $hint ) | ||
| $hint | Yiisoft\Form\Field\Part\Hint | |
protected function renderHint(Hint $hint): string
{
return $hint
->inputData($this->getInputData())
->render();
}
| protected string renderLabel ( Yiisoft\Form\Field\Part\Label $label ) | ||
| $label | Yiisoft\Form\Field\Part\Label | |
protected function renderLabel(Label $label): string
{
return $label
->inputData($this->getInputData())
->useInputId(false)
->render();
}
| public self separator ( string $separator ) | ||
| $separator | string | |
public function separator(string $separator): self
{
$new = clone $this;
$new->widget = $this->widget->separator($separator);
return $new;
}
| protected boolean shouldHideLabel ( ) |
protected function shouldHideLabel(): bool
{
return false;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::template()
Set layout template for render a field.
| public Yiisoft\Form\Field\RadioList template ( string $template ) | ||
| $template | string | |
final public function template(string $template): static
{
$new = clone $this;
$new->template = $template;
return $new;
}
| public Yiisoft\Form\Field\RadioList templateBegin ( string $template ) | ||
| $template | string | |
final public function templateBegin(string $template): static
{
$new = clone $this;
$new->templateBegin = $template;
return $new;
}
| public Yiisoft\Form\Field\RadioList templateEnd ( string $template ) | ||
| $template | string | |
final public function templateEnd(string $template): static
{
$new = clone $this;
$new->templateEnd = $template;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::token()
| public Yiisoft\Form\Field\RadioList token ( string $token, string|\Stringable $value ) | ||
| $token | string | |
| $value | string|\Stringable | |
final public function token(string $token, string|Stringable $value): static
{
$this->validateToken($token);
$new = clone $this;
$new->extraTokens[$token] = $value;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\PartsField::tokens()
| public Yiisoft\Form\Field\RadioList tokens ( array $tokens ) | ||
| $tokens | array | |
final public function tokens(array $tokens): static
{
$new = clone $this;
foreach ($tokens as $token => $value) {
if (!is_string($token)) {
throw new InvalidArgumentException(
sprintf(
'Token should be string. %s given.',
get_debug_type($token),
)
);
}
if (!is_string($value) && !$value instanceof Stringable) {
throw new InvalidArgumentException(
sprintf(
'Token value should be string or Stringable. %s given.',
get_debug_type($value),
)
);
}
$this->validateToken($token);
$new->extraTokens[$token] = $value;
}
return $new;
}
| public self uncheckValue ( boolean|float|integer|string|\Stringable|null $value ) | ||
| $value | boolean|float|integer|string|\Stringable|null | |
public function uncheckValue(bool|float|int|string|Stringable|null $value): self
{
$new = clone $this;
$new->widget = $this->widget->uncheckValue($value);
return $new;
}
| public Yiisoft\Form\Field\RadioList useContainer ( boolean $use ) | ||
| $use | boolean | |
final public function useContainer(bool $use): static
{
$new = clone $this;
$new->useContainer = $use;
return $new;
}
Defined in: Yiisoft\Form\Field\Base\ValidationClass\ValidationClassTrait::validClass()
Set valid CSS class.
| public self validClass ( string|null $class ) | ||
| $class | string|null | |
public function validClass(?string $class): self
{
$new = clone $this;
$new->validClass = $class;
return $new;
}
| public Yiisoft\Form\Field\RadioList value ( mixed $value ) | ||
| $value | mixed | |
final public function value(mixed $value): static
{
$new = clone $this;
$new->customValue = $value;
$new->useCustomValue = true;
return $new;
}
Signup or Login in order to comment.