public function FlagListsSettingForm::buildForm in Flag Lists 4.0.x
Defines the settings form for Flagging collection entities.
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 Form definition array.
Overrides ConfigFormBase::buildForm
File
- src/
Form/ FlagListsSettingForm.php, line 133
Class
- FlagListsSettingForm
- Class FlaggingCollectionSettingsForm.
Namespace
Drupal\flag_lists\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$config = $this
->config('flag_lists.settings');
$form['flag_settings'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Overview Settings'),
];
$flagOverviewLink = Link::createFromRoute('Flag Overview', 'entity.flag.collection')
->toString();
$form['flag_settings']['hide_collections'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Hide Flagging Collections in the @link.', [
'@link' => $flagOverviewLink,
]),
'#default_value' => $config
->get('hide_collections'),
'#description' => $this
->t('Do you want to hide the Flagging Collections in the @link?', [
'@link' => $flagOverviewLink,
]),
];
$flagCollectionsInDisplayLink = Link::createFromRoute('Content Types Manage Display Forms', 'entity.node_type.collection')
->toString();
$form['content_types'] = [
'#type' => 'fieldset',
'#title' => $this
->t('Content Types Settings'),
];
$form['content_types']['hide_collections_in_displays'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Hide Flagging Collections in the @link as well as for other entities.', [
'@link' => $flagCollectionsInDisplayLink,
]),
'#default_value' => $config
->get('hide_collections_in_displays'),
'#description' => $this
->t('Do you want to hide the Flagging Collections in the @link as well as for other entities?', [
'@link' => $flagCollectionsInDisplayLink,
]),
];
$form['content_types']['hide_templates_in_displays'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Hide Flagging Templates in the @link as well as for other entities.', [
'@link' => $flagCollectionsInDisplayLink,
]),
'#default_value' => $config
->get('hide_templates_in_displays'),
'#description' => $this
->t('Do you want to hide the Flagging Templates in the @link as well as for other entities?', [
'@link' => $flagCollectionsInDisplayLink,
]),
];
return parent::buildForm($form, $form_state);
}