function _crumbs_debug_devel_page in Crumbs, the Breadcrumbs suite 7.2
1 string reference to '_crumbs_debug_devel_page'
- crumbs_menu in ./
crumbs.info.inc - Implements hook_menu().
File
- admin/
crumbs.debug.inc, line 139
Code
function _crumbs_debug_devel_page() {
drupal_set_title('Crumbs debug - devel');
$path_to_test = '';
if (isset($_GET['path_to_test'])) {
$path_to_test = $_GET['path_to_test'];
}
elseif (!empty($_SESSION['crumbs.admin.debug.history'])) {
foreach ($_SESSION['crumbs.admin.debug.history'] as $path => $true) {
if ('admin' !== substr($path, 0, 5)) {
$path_to_test = $path;
}
elseif ('admin/structure/crumbs' !== substr($path, 0, 22)) {
$admin_path_to_test = $path;
}
}
if (empty($path_to_test) && !empty($admin_path_to_test)) {
$path_to_test = $admin_path_to_test;
}
}
$path_checked = check_plain($path_to_test);
$form_action = url('admin/structure/crumbs/debug/devel');
$input_html = <<<EOT
<input id="crumbs-admin-debug-path" type="text" class="form-text" size="40" name="path_to_test" value="{<span class="php-variable">$path_checked</span>}" />
<input type="submit" value="Go" class="form-submit" />
EOT;
$input_html = t('Internal data for: !text_field', array(
'!text_field' => $input_html,
));
$placeholders = array(
'!plugin_weights' => l(t('Plugin weights'), 'admin/structure/crumbs'),
'!display_settings' => l(t('Display settings'), 'admin/structure/crumbs/display'),
);
$paragraphs = array();
$paragraphs[] = <<<EOT
This page shows the data internally generated by Crumbs to create a breadcrumb for the given path.
EOT;
$paragraphs[] = <<<EOT
The behavior depends on the !plugin_weights, !display_settings and the current theme.
EOT;
$paragraphs[] = <<<EOT
The theme is the one active for this administration page, which is not necessarily the same as for the page where you want the breadcrumb to appear.
EOT;
$text = '';
foreach ($paragraphs as $paragraph) {
$paragraph = str_replace("\n", '<br/>', $paragraph);
$text .= '<p>' . t($paragraph, $placeholders) . '</p>' . "\n";
}
$html = <<<EOT
<form method="get" action="{<span class="php-variable">$form_action</span>}">
{<span class="php-variable">$text</span>}
<label for="path">{<span class="php-variable">$input_html</span>}</label>
</form>
EOT;
if (strlen($path_to_test)) {
$path_to_test = drupal_get_normal_path($path_to_test);
$html .= _crumbs_admin_debug_devel_data($path_to_test);
}
if (!empty($_SESSION['crumbs.admin.debug.history'])) {
$recently_visited = '';
foreach (array_reverse($_SESSION['crumbs.admin.debug.history']) as $path => $true) {
if ('admin/structure/crumbs/debug' !== substr($path, 0, 28)) {
// We can't use l() directly, since this would add an "active" class.
$url = url('admin/structure/crumbs/debug/devel', array(
'query' => array(
'path_to_test' => $path,
),
));
$link = l($path, $url, array(
'external' => TRUE,
));
$recently_visited .= '<li>' . $link . '</li>';
}
}
if ($recently_visited) {
$html .= t('Recently visited') . ':<ol>' . $recently_visited . '</ol>';
}
}
return $html;
}