public static function ElementBase::processSelectOrOther in Select (or other) 8.3
Same name and namespace in other branches
- 8 src/Element/ElementBase.php \Drupal\select_or_other\Element\ElementBase::processSelectOrOther()
- 4.x src/Element/ElementBase.php \Drupal\select_or_other\Element\ElementBase::processSelectOrOther()
Render API callback: Expands the select_or_other element type.
Expands the select or other element to have a 'select' and 'other' field.
3 calls to ElementBase::processSelectOrOther()
- Buttons::processSelectOrOther in src/
Element/ Buttons.php - Render API callback: Expands the select_or_other element type.
- ElementsTest::testProcessSelectOrOther in Tests/
src/ Unit/ ElementsTest.php - Tests the processing of a select or other element.
- Select::processSelectOrOther in src/
Element/ Select.php - Render API callback: Expands the select_or_other element type.
2 methods override ElementBase::processSelectOrOther()
- 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 79 - Contains Drupal\select_or_other\Element\ElementBase.
Class
- ElementBase
- Base class for select or other form elements.
Namespace
Drupal\select_or_other\ElementCode
public static function processSelectOrOther(&$element, FormStateInterface $form_state, &$complete_form) {
$element['select'] = [
'#default_value' => $element['#default_value'],
'#required' => $element['#required'],
'#multiple' => $element['#multiple'],
'#options' => ElementBase::addOtherOption($element['#options']),
'#weight' => 10,
];
// Create the 'other' textfield.
$element['other'] = [
'#type' => 'textfield',
'#weight' => 20,
];
return $element;
}