function NodeFormHooks::formSystemThemesAdminFormAlter

Implements hook_form_FORM_ID_alter().

Alters the theme form to use the admin theme on node editing.

Attributes

#[Hook('form_system_themes_admin_form_alter')]

See also

self::systemThemesAdminFormSubmit()

File

core/modules/node/src/Hook/NodeFormHooks.php, line 31

Class

NodeFormHooks
Form hook implementations for the node module.

Namespace

Drupal\node\Hook

Code

public function formSystemThemesAdminFormAlter(&$form, FormStateInterface $form_state, $form_id) : void {
  $form['admin_theme']['use_admin_theme'] = [
    '#type' => 'checkbox',
    '#title' => $this->t('Use the administration theme when editing or creating content'),
    '#description' => $this->t('Control which roles can "View the administration theme" on the <a href=":permissions">Permissions page</a>.', [
      ':permissions' => Url::fromRoute('user.admin_permissions.module', [
        'modules' => 'system',
      ])->toString(),
    ]),
    '#default_value' => $this->configFactory
      ->getEditable('node.settings')
      ->get('use_admin_theme'),
  ];
  $form['#submit'][] = [
    self::class,
    'systemThemesAdminFormSubmit',
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.