You are here

protected static function ElementBase::prepareStates in Select (or other) 8.3

Prepares a form API #states array.

Parameters

$state:

$elementName:

$valueKey:

$value:

Return value

array

2 calls to ElementBase::prepareStates()
Buttons::processSelectOrOther in src/Element/Buttons.php
Render API callback: Expands the select_or_other element type.
Select::processSelectOrOther in src/Element/Select.php
Render API callback: Expands the select_or_other element type.

File

src/Element/ElementBase.php, line 46
Contains Drupal\select_or_other\Element\ElementBase.

Class

ElementBase
Base class for select or other form elements.

Namespace

Drupal\select_or_other\Element

Code

protected static function prepareStates($state, $elementName, $valueKey, $value) {
  return [
    $state => [
      ':input[name="' . $elementName . '"]' => [
        $valueKey => $value,
      ],
    ],
  ];
}