function panels_edit_display in Panels 5.2
Form definition for the panels display editor
No validation function is necessary, as all 'validation' is handled either in the lead-up to form rendering (through the selection of specified content types) or by the validation functions specific to the ajax modals & content types.
See also
1 string reference to 'panels_edit_display'
- _panels_edit in includes/
display_edit.inc - Handle calling and processing of the form for editing display content.
File
- includes/
display_edit.inc, line 63
Code
function panels_edit_display($display, $destination) {
$form['did'] = array(
'#type' => 'hidden',
'#value' => $display->did,
'#id' => 'panel-did',
);
$form['op'] = array(
'#type' => 'hidden',
'#id' => 'panel-op',
);
$form['panels_display'] = array(
'#type' => 'value',
'#value' => $display,
);
if (!empty($destination)) {
$form['destination'] = array(
'#type' => 'value',
'#value' => $destination,
);
}
else {
$form['#redirect'] = FALSE;
}
$explanation_text = '<p>';
$explanation_text .= t('Grab the title bar of any pane to drag-and-drop it into another panel. Click the add pane button (!addicon) in any panel to add more content. Click the configure (!configicon) button on any pane to re-configure that pane. Click the cache (!cacheicon) button to configure caching for that pane specifically. Click the show/hide (!showicon/!hideicon) toggle button to show or hide that pane. Panes hidden in this way will be hidden from <em>everyone</em> until the hidden status is toggled off.', array(
'!addicon' => '<span class="inline-icon-help">' . theme('image', panels_get_path('images/icon-addcontent.png'), t('Add content to this panel'), t('Add content to this panel')) . '</span>',
'!configicon' => '<span class="inline-icon-help">' . theme('image', panels_get_path('images/icon-configure.png'), t('Configure this pane'), t('Configure this pane')) . '</span>',
'!cacheicon' => '<span class="inline-icon-help">' . theme('image', panels_get_path('images/icon-cache.png'), t('Control caching'), t('Control caching')) . '</span>',
'!showicon' => '<span class="inline-icon-help">' . theme('image', panels_get_path('images/icon-showpane.png'), t('Show this pane'), t('Show this pane')) . '</span>',
'!hideicon' => '<span class="inline-icon-help">' . theme('image', panels_get_path('images/icon-hidepane.png'), t('Hide this pane'), t('Hide this pane')) . '</span>',
));
$explanation_text .= '</p>';
$form['explanation'] = array(
'#value' => $explanation_text,
);
$layout = panels_get_layout($display->layout);
$layout_panels = panels_get_panels($layout, $display);
$form['button']['#tree'] = TRUE;
$caches = panels_get_caches();
foreach ($display->content as $pid => $pane) {
// This test ensures we don't put anything for panes that are in panels
// that don't exist -- as can happen when flexible changes.
if ($layout_panels[$pane->panel]) {
$form['button'][$pid]['#tree'] = TRUE;
if ($caches && user_access('use panels caching features')) {
$form['button'][$pid]['cache'] = panels_add_button('icon-cache.png', t('Caching'), t('Control caching'), 'pane-cache');
}
$form['button'][$pid]['show_hide'] = panels_add_button($pane->shown ? 'icon-hidepane.png' : 'icon-showpane.png', t('Show/Hide Toggle'), $pane->shown ? t('Hide this pane') : t('Show this pane'), 'pane-toggle-shown');
$form['button'][$pid]['configure'] = panels_add_button('icon-configure.png', t('Configure'), t('Configure this pane'), 'pane-configure');
$form['button'][$pid]['delete'] = panels_add_button('icon-delete.png', t('Delete'), t('Remove this pane'), 'pane-delete');
}
}
foreach ($layout_panels as $id => $name) {
$form['panels'][$id]['add'] = panels_add_button('icon-addcontent.png', t('Add content'), t('Add content to this panel'), 'pane-add', "pane-add-{$id}");
}
$form['panel'] = array(
'#tree' => TRUE,
);
$form['panel']['pane'] = array(
'#tree' => TRUE,
);
foreach ($layout_panels as $panel_id => $title) {
$form['panel']['pane'][$panel_id] = array(
// Use 'hidden' instead of 'value' so the js can access it.
'#type' => 'hidden',
'#default_value' => implode(',', (array) $display->panels[$panel_id]),
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
'#id' => 'panels-dnd-save',
);
$form['cancel'] = array(
'#type' => 'submit',
'#value' => t('Cancel'),
);
$form['hide'] = array(
'#prefix' => '<span id="panels-js-only">',
'#suffix' => '</span>',
);
$form['hide']['hide-all'] = array(
'#type' => 'submit',
'#value' => t('Hide all'),
'#id' => 'panels-hide-all',
);
$form['hide']['show-all'] = array(
'#type' => 'submit',
'#value' => t('Show all'),
'#id' => 'panels-show-all',
);
$form['hide']['cache-settings'] = array(
'#type' => 'submit',
'#value' => t('Cache settings'),
'#id' => 'panels-cache-settings',
);
return $form;
}