function path_form_node_form_alter

path_form_node_form_alter(&$form, FormStateInterface $form_state)

Implements hook_form_BASE_FORM_ID_alter() for \Drupal\node\NodeForm.

File

core/modules/path/path.module, line 43
Enables users to rename URLs.

Code

function path_form_node_form_alter(&$form, FormStateInterface $form_state) {
  $node = $form_state->getFormObject()->getEntity();
  $form['path_settings'] = array(
    '#type' => 'details',
    '#title' => t('URL path settings'),
    '#open' => !empty($form['path']['widget'][0]['alias']['#value']),
    '#group' => 'advanced',
    '#access' => !empty($form['path']['#access']) && $node->hasField('path') && $node->get('path')->access('edit'),
    '#attributes' => array(
      'class' => array('path-form'),
    ),
    '#attached' => array(
      'library' => array('path/drupal.path'),
    ),
    '#weight' => 30,
  );
  $form['path']['#group'] = 'path_settings';
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!path!path.module/function/path_form_node_form_alter/8.1.x