public function MediaSettingsForm::buildForm in Cookie Content Blocker 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
- modules/
cookie_content_blocker_media/ src/ Form/ MediaSettingsForm.php, line 70
Class
- MediaSettingsForm
- Form builder to manage settings for Cookie content blocker - Media.
Namespace
Drupal\cookie_content_blocker_media\FormCode
public function buildForm(array $form, FormStateInterface $form_state) : array {
$form = parent::buildForm($form, $form_state);
$sources = array_filter($this->mediaSourcePluginManager
->getDefinitions(), function ($definition) {
return !empty($definition['providers']);
});
$form['providers'] = [
'#type' => 'container',
'#tree' => TRUE,
'#title' => $this
->t('Providers'),
];
$providers = array_unique(array_merge(...array_column($sources, 'providers')));
foreach ($providers as $provider) {
$form['providers'][$provider] = $this
->providerFormContainer($provider);
}
return $form;
}