function finder_ui_element_item_page in Finder 7.2
Finder UI element item page.
Parameters
$finder: The finder object.
$feid: The element machine name.
$item_key: The item key.
$js: The $js param required by ctools.
Return value
The output.
1 string reference to 'finder_ui_element_item_page'
- finder_ui_menu in modules/
finder_ui/ finder_ui.module - Implements hook_menu().
File
- modules/
finder_ui/ includes/ element-item.inc, line 25
Code
function finder_ui_element_item_page($finder, $feid, $item_key, $js) {
ctools_include('modal');
ctools_include('ajax');
ctools_include('object-cache');
finder_inc('element', 'finder_ui');
$finder = ctools_object_cache_get('finder', $finder->name);
$finder_ui_element = finder_ui_element($finder, $feid);
$title = $finder_ui_element['items'][$item_key]['#item']['#title'];
$item = $finder_ui_element['items'][$item_key];
$form_state = array(
'title' => $title,
'ajax' => $js,
'finder' => $finder,
'feid' => $feid,
'item_key' => $item_key,
'item' => $item,
);
$output = ctools_modal_form_wrapper('finder_ui_element_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);
$element =& $finder->elements[$feid];
foreach ($form_state['values'] as $key => $value) {
if ($key != 'settings') {
$element->{$key} = $value;
}
}
foreach ($form_state['values']['settings'] as $key => $value) {
$element->settings[$key] = $value;
}
ctools_object_cache_set('finder', $finder->name, $finder);
$finder_ui_element = finder_ui_element($finder, $feid);
$item = $finder_ui_element['items'][$item_key];
$commands = array();
$output = finder_ui_element_item($finder, $feid, $item_key, $item);
$commands[] = ajax_command_html('#finder-ui-element-' . $feid . '-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;
}