function path_breadcrumbs_ui_breadcrumbs_list in Path Breadcrumbs 7.2
Same name and namespace in other branches
- 7.3 path_breadcrumbs_ui/path_breadcrumbs_ui.admin.inc \path_breadcrumbs_ui_breadcrumbs_list()
Page callback for module settings page.
1 string reference to 'path_breadcrumbs_ui_breadcrumbs_list'
- path_breadcrumbs_ui_menu in path_breadcrumbs_ui/
path_breadcrumbs_ui.module - Implements hook_menu().
File
- path_breadcrumbs_ui/
path_breadcrumbs_ui.admin.inc, line 11 - Administrative callbacks for PATH BREADCRUMBS UI module.
Code
function path_breadcrumbs_ui_breadcrumbs_list($form, $form_state) {
// Load path breadcrumbs.
$result = path_breadcrumbs_load_all();
// NOTE: Is it too heavy?
$form_state['storage']['objects'] = $result;
$form['#tree'] = TRUE;
foreach ($result as $path) {
$form[$path->machine_name]['title']['#markup'] = $path->name;
// If object is overwritten.
if ($path->is_overwritten) {
$form[$path->machine_name]['title']['#markup'] .= '<sup>' . $path->type . '</sup>';
}
$form[$path->machine_name]['name']['#markup'] = $path->machine_name;
$form[$path->machine_name]['path']['#markup'] = $path->path;
// All paths are in $form_state['values']['paths'].
$form[$path->machine_name]['#parents'] = array(
'paths',
$path->machine_name,
);
// Create operations for current breadcrumb.
$operations = array();
if ($path->disabled == TRUE) {
$operations[] = array(
'title' => t('Enable'),
'href' => 'admin/structure/path-breadcrumbs/enable/' . $path->machine_name,
);
}
$operations[] = array(
'title' => t('Edit'),
'href' => 'admin/structure/path-breadcrumbs/edit/' . $path->machine_name,
);
$operations[] = array(
'title' => t('Clone'),
'href' => 'admin/structure/path-breadcrumbs/clone/' . $path->machine_name,
);
$operations[] = array(
'title' => t('Export'),
'href' => 'admin/structure/path-breadcrumbs/export/' . $path->machine_name,
);
if (empty($path->in_code_only)) {
$operations[] = array(
'title' => $path->is_overwritten ? t('Revert') : t('Delete'),
'href' => 'admin/structure/path-breadcrumbs/delete/' . $path->machine_name,
);
}
if ($path->disabled == FALSE) {
$operations[] = array(
'title' => t('Disable'),
'href' => 'admin/structure/path-breadcrumbs/disable/' . $path->machine_name,
);
}
$form[$path->machine_name]['actions']['#markup'] = theme('links__ctools_dropbutton', array(
'links' => $operations,
'attributes' => array(
'class' => array(
'links',
'inline',
),
),
));
$form[$path->machine_name]['weight'] = array(
'#type' => 'weight',
'#default_value' => $path->weight,
'#delta' => 100,
'#attributes' => array(
'class' => array(
'path-breadcrumbs-ui-table-weight',
),
),
);
$form[$path->machine_name]['disabled'] = array(
'#type' => 'value',
'#value' => $path->disabled,
);
}
$form['actions'] = array(
'#type' => 'action',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
$form['#attached']['css'][] = drupal_get_path('module', 'path_breadcrumbs_ui') . '/path_breadcrumbs_ui.css';
return $form;
}