1 layout.module _layout_set_message_on_path_error(array &$form, $field_name, $path)

Ensure path is properly formed.

Parameters

array $form: An associative array containing the structure of the form.

string $field_name: The machine name of the field.

string $path: The menu routing path, with all placeholders represented by "%" symbols.

Return value

bool: TRUE if error found, else FALSE

File

core/modules/layout/layout.module, line 2810
The Layout module creates pages and wraps existing pages in layouts.

Code

function _layout_set_message_on_path_error(array &$form, $field_name, $path) {
  $parts = explode('/', $path);
  foreach ($parts as $part) {
    $wildcard_position = strpos($part, '%');
    if ($wildcard_position !== FALSE && ($wildcard_position > 0 || strlen($part) > 1)) {
      form_error($form[$field_name], t('Placeholders must be the only character in their part of the path i.e. "@part" should be "%".', array('@part' => $part)));
      return TRUE;
    }
  }
  return FALSE;
}