function finder_ui_item_page in Finder 7.2
Finder UI item page.
Parameters
$finder: The finder object.
$item_key: The item key.
$js: The $js param required by ctools.
Return value
The output.
1 string reference to 'finder_ui_item_page'
- finder_ui_menu in modules/
finder_ui/ finder_ui.module - Implements hook_menu().
File
- modules/
finder_ui/ includes/ item.inc, line 23
Code
function finder_ui_item_page($finder, $item_key, $js) {
ctools_include('modal');
ctools_include('ajax');
ctools_include('object-cache');
finder_inc('finder', 'finder_ui');
$finder = ctools_object_cache_get('finder', $finder->name);
$finder_ui = finder_ui($finder);
$title = $finder_ui['items'][$item_key]['#item']['#title'];
$item = $finder_ui['items'][$item_key];
$form_state = array(
'title' => $title,
'ajax' => $js,
'finder' => $finder,
'item_key' => $item_key,
'item' => $item,
);
$output = ctools_modal_form_wrapper('finder_ui_item_form', $form_state);
if ($form_state['executed'] && $js) {
if ($form_state['triggering_element']['#parents'][1] == 'submit') {
$finder = ctools_object_cache_get('finder', $finder->name);
foreach ($form_state['values'] as $key => $value) {
if ($key != 'settings') {
$finder->{$key} = $value;
}
}
foreach ($form_state['values']['settings'] as $key => $value) {
$finder->settings[$key] = $value;
}
ctools_object_cache_set('finder', $finder->name, $finder);
$finder_ui = finder_ui($finder);
$item = $finder_ui['items'][$item_key];
$commands = array();
$output = finder_ui_item($finder, $item_key, $item);
$commands[] = ajax_command_html('#finder-ui-item-' . $item_key, $output);
$commands[] = ajax_command_css('#edit-changed', array(
'display' => 'block',
));
}
$commands[] = ctools_modal_command_dismiss();
print ajax_render($commands);
exit;
}
if ($js) {
print ajax_render($output);
exit;
}
// Otherwise, just return the output.
return $output;
}