menu_valid_path

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 menu_valid_path($form_item)

Validates the path of a menu link being created or edited.

Rückgabewert

TRUE if it is a valid path AND the current user has access permission, FALSE otherwise.

Verwandte Themen

▾ 3 functions call menu_valid_path()

menu_edit_item_validate in modules/menu/menu.admin.inc
Validate form values for a menu link being added or edited.
system_site_information_settings_validate in modules/system/system.admin.inc
Validate the submitted site-information form.
theme_textfield in includes/form.inc
Format a textfield.

Code

includes/menu.inc, line 2521

<?php
function menu_valid_path($form_item) {
  global $menu_admin;
  $item = array();
  $path = $form_item['link_path'];
  // We indicate that a menu administrator is running the menu access check.
  $menu_admin = TRUE;
  if ($path == '<front>' || menu_path_is_external($path)) {
    $item = array('access' => TRUE);
  }
  elseif (preg_match('/\/\%/', $path)) {
    // Path is dynamic (ie 'user/%'), so check directly against menu_router table.
    if ($item = db_fetch_array(db_query("SELECT * FROM {menu_router} where path = '%s' ", $path))) {
      $item['link_path']  = $form_item['link_path'];
      $item['link_title'] = $form_item['link_title'];
      $item['external']   = FALSE;
      $item['options'] = '';
      _menu_link_translate($item);
    }
  }
  else {
    $item = menu_get_item($path);
  }
  $menu_admin = FALSE;
  return $item && $item['access'];
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen