| 1 layout.admin.inc | _layout_path_matches_description($path, $layout_name, $is_new) |
Returns description text for path entry fields, with dynamic information about the entered path and toggleable placeholder examples.
Parameters
string $path: The router path.
string|null $layout_name: The name of the layout that is doing the checking.
bool $is_new: Whether this is a new layout.
Return value
string: HTML markup of description text for a path entry field.
File
- core/
modules/ layout/ layout.admin.inc, line 873 - Admin page callbacks for the Layout module.
Code
function _layout_path_matches_description($path, $layout_name, $is_new) {
$has_placeholder = strpos((string) $path, '%') !== FALSE;
if (empty($path)) {
$path_matches_text = t('Please enter a path.');
}
else {
if (_layout_menu_router_path_exists($path, $layout_name)) {
if ($has_placeholder) {
if ($is_new) {
$path_matches_text = t('This layout will override the default layout for existing page(s) whose paths match this pattern.');
}
else {
$path_matches_text = t('This layout overrides the default layout for existing page(s) whose paths match this pattern.');
}
}
else {
if ($is_new) {
$path_matches_text = t('This layout will override the default layout for an existing page whose path matches this pattern.');
}
else {
$path_matches_text = t('This layout overrides the default layout for an existing page whose path matches this pattern.');
}
}
}
else {
if ($has_placeholder) {
if ($is_new) {
$path_matches_text = t('This path will create pages whose paths match this pattern.');
}
else {
$path_matches_text = t('This path provides pages whose paths match this pattern.');
}
}
else {
if ($is_new) {
$path_matches_text = t('This path will create a page at this path.');
}
else {
$path_matches_text = t('This path provides a page at this path.');
}
}
}
}
$form['path_matches_text'] = array(
'#markup' => $path_matches_text,
'#prefix' => '<div class="description">',
'#suffix' => '</div>',
);
return backdrop_render($form);
}