public function Boolean::formElement in Schema.org Metatag 8.2
A property form element.
This will actually be rendered only by properties that have no more sub-properties.
Parameters
array $input_values: The array of input values used by form().
Return value
array A form array.
Overrides PropertyTypeBase::formElement
File
- src/
Plugin/ schema_metatag/ PropertyType/ Boolean.php, line 22
Class
- Boolean
- Provides a plugin for the 'Boolean' Schema.org property type.
Namespace
Drupal\schema_metatag\Plugin\schema_metatag\PropertyTypeCode
public function formElement(array $input_values) {
$value = $input_values['value'];
$form['#type'] = 'select';
$form['#title'] = $input_values['title'];
$form['#description'] = $input_values['description'];
$form['#default_value'] = !empty($value) ? $value : '';
$form['#empty_option'] = $this
->t('- None -');
$form['#empty_value'] = '';
$form['#options'] = [
'False' => $this
->t('False'),
'True' => $this
->t('True'),
];
return $form;
}