You are here

menu_link_weight_test.module in Menu Link Weight 7

Support module for the Menu Link Weight Simpletests.

File

tests/menu_link_weight_test.module
View source
<?php

/**
 * @file
 * Support module for the Menu Link Weight Simpletests.
 */

/**
 * Implements hook_element_info_alter().
 *
 * @see https://drupal.stackexchange.com/questions/49216/how-to-add-a-process-callback-to-a-fieldset-form-element-without-overwriting-th
 */
function menu_link_weight_test_element_info_alter(&$types) {

  // Set the Menu link weight process function all fieldsets, but check
  // within the process function whether we are editing a Menu Link Weight
  // element.
  $types['fieldset']['#process'][] = 'menu_link_weight_test_element_process';
}

/**
 * Form process function that will tell us where to put the current menu link.
 */
function menu_link_weight_test_element_process($element, &$form_state) {

  // Can be one of "top", "above_{mlid}", "below_{mlid}":
  $parent_value = variable_get('menu_link_weight_test_parent_value');
  $form_state['menu_link_weight_relative_position'][$parent_value] = variable_get('menu_link_weight_test_relative_position');
  return $element;
}

Functions

Namesort descending Description
menu_link_weight_test_element_info_alter Implements hook_element_info_alter().
menu_link_weight_test_element_process Form process function that will tell us where to put the current menu link.