You are here

function token_form_node_form_alter in Token 8

Implements hook_form_BASE_FORM_ID_alter() for node_form.

Populates menu_link field on nodes from the menu item on unsaved nodes.

See also

menu_ui_form_node_form_submit()

token_entity_base_field_info()

File

./token.module, line 682
Enhances the token API in core: adds a browseable UI, missing tokens, etc.

Code

function token_form_node_form_alter(&$form, FormStateInterface $form_state) {
  if (!\Drupal::moduleHandler()
    ->moduleExists('menu_ui')) {
    return;
  }
  $form['#entity_builders'][] = 'token_node_menu_link_submit';
}