menu_test.module

Same filename in other branches
  1. 7.x modules/simpletest/tests/menu_test.module
  2. 9 core/modules/system/tests/modules/menu_test/menu_test.module
  3. 8.9.x core/modules/system/tests/modules/menu_test/menu_test.module
  4. 10 core/modules/system/tests/modules/menu_test/menu_test.module

File

core/modules/system/tests/modules/menu_test/menu_test.module

View source
<?php


/**
 * @file
 * Module that implements various hooks for menu tests.
 */
declare (strict_types=1);

/**
 * Sets a static variable for the testMenuName() test.
 *
 * Used to change the menu_name parameter of a menu.
 *
 * @param string $new_name
 *   (optional) If set, will change the $menu_name value.
 *
 * @return string
 *   The $menu_name value to use.
 */
function menu_test_menu_name($new_name = '') {
    static $menu_name = 'original';
    if ($new_name) {
        $menu_name = $new_name;
    }
    return $menu_name;
}

/**
 * Title callback: Concatenates the title and case number.
 *
 * @param string $title
 *   Title string.
 * @param int $case_number
 *   (optional) The current case number which it tests (defaults to 3).
 *
 * @return string
 *   A string containing the title and case number.
 *
 * @see menu_test_menu()
 */
function menu_test_title_callback($title, $case_number = 3) {
    return t($title) . ' - Case ' . $case_number;
}

Functions

Title Deprecated Summary
menu_test_menu_name Sets a static variable for the testMenuName() test.
menu_test_title_callback Title callback: Concatenates the title and case number.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.