public function MetaPositionConfig::buildForm in Meta position 8
Form constructor.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form structure.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ MetaPositionConfig.php, line 31
Class
- MetaPositionConfig
- Config form settings for meta_position module.
Namespace
Drupal\meta_position\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$options = array_map(function (NodeType $nodeType) {
return $nodeType
->label();
}, NodeType::loadMultiple());
$config = $this
->config('meta_position.settings');
$form['enabled'] = array(
'#type' => 'checkbox',
'#title' => $this
->t('Display block meta as vertical tabs'),
'#description' => $this
->t('Use the checkbox to display the node meta block as vertical tabs and under the main node form.'),
'#default_value' => $config
->get('enabled'),
);
$form['node_types'] = [
'#title' => $this
->t('Content type.'),
'#type' => 'checkboxes',
'#options' => $options,
'#description' => $this
->t('Select the content type on which display the node meta block as vertical tabs and under the main node form. Leave <b>empty</b> to select all the content types.'),
'#default_value' => $config
->get('node_types'),
'#states' => [
'visible' => [
':input[name="enabled"]' => [
'checked' => TRUE,
],
],
],
];
return parent::buildForm($form, $form_state);
}