menu_link_weight_test.module in Menu Link Weight 8
Same filename and directory in other branches
Support module for the Menu Link Weight tests.
File
tests/modules/menu_link_weight_test/menu_link_weight_test.moduleView source
<?php
/**
* @file
* Support module for the Menu Link Weight tests.
*/
use Drupal\Core\Form\FormStateInterface;
/**
* Implements hook_form_BASE_FORM_ID_alter() for node forms.
*/
function menu_link_weight_test_form_node_form_alter(&$form, FormStateInterface $form_state) {
$state = \Drupal::state();
$parent_value = $state
->get('menu_link_weight_test_parent_value');
$form_state
->set([
'menu_link_weight_relative_position',
$parent_value,
], $state
->get('menu_link_weight_test_relative_position'));
}
/**
* Implements hook_form_BASE_FORM_ID_alter() for node forms.
*/
function menu_link_weight_test_form_menu_link_content_form_alter(&$form, FormStateInterface $form_state) {
$state = \Drupal::state();
$parent_value = $state
->get('menu_link_weight_test_parent_value');
$form_state
->set([
'menu_link_weight_relative_position',
$parent_value,
], $state
->get('menu_link_weight_test_relative_position'));
}
Functions
Name | Description |
---|---|
menu_link_weight_test_form_menu_link_content_form_alter | Implements hook_form_BASE_FORM_ID_alter() for node forms. |
menu_link_weight_test_form_node_form_alter | Implements hook_form_BASE_FORM_ID_alter() for node forms. |