function NodeHooks1::formSystemThemesAdminFormAlter

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/src/Hook/NodeHooks1.php, line 293

Class

NodeHooks1
Hook implementations for node.

Namespace

Drupal\node\Hook

Code

public function formSystemThemesAdminFormAlter(&$form, FormStateInterface $form_state, $form_id) : void {
    $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.