function node_form_system_themes_admin_form_alter

Same name and namespace in other branches
  1. 9 core/modules/node/node.module \node_form_system_themes_admin_form_alter()
  2. 8.9.x core/modules/node/node.module \node_form_system_themes_admin_form_alter()
  3. 10 core/modules/node/node.module \node_form_system_themes_admin_form_alter()

Implements hook_form_FORM_ID_alter().

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

See also

node_form_system_themes_admin_form_submit()

File

core/modules/node/node.module, line 683

Code

function node_form_system_themes_admin_form_alter(&$form, FormStateInterface $form_state, $form_id) {
    $form['admin_theme']['use_admin_theme'] = [
        '#type' => 'checkbox',
        '#title' => t('Use the administration theme when editing or creating content'),
        '#description' => 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' => \Drupal::configFactory()->getEditable('node.settings')
            ->get('use_admin_theme'),
    ];
    $form['#submit'][] = 'node_form_system_themes_admin_form_submit';
}

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