function panels_views_edit in Panels 5.2
Provide the pane edit dialog.
1 string reference to 'panels_views_edit'
- panels_views_panels_content_types in panels_views/
panels_views.module - Implementation of hook_panels_content_types().
File
- panels_views/
panels_views.module, line 896 - panels_views.module
Code
function panels_views_edit($id, $parents, $conf = array()) {
$pv = panels_views_load($id);
if (empty($pv)) {
$form['markup'] = array(
'#value' => t('The view for this pane is not valid or has been deleted from the system. This pane cannot render; you must either delete this pane or restore the panel view. If you save this pane and then restore the panel view, your settings may be lost.'),
);
return $form;
}
// Provide defaults for the items we let the user edit.
if (empty($conf)) {
if ($pv->allow_type) {
$conf['view_type'] = $pv->view_type;
}
if ($pv->allow_link_to_view) {
$conf['link_to_view'] = $pv->link_to_view;
}
if ($pv->allow_more_link) {
$conf['more_link'] = $pv->more_link;
}
if ($pv->allow_more_text) {
$conf['more_text'] = $pv->more_text;
}
if ($pv->allow_feed_icons) {
$conf['feed_icons'] = $pv->feed_icons;
}
if ($pv->allow_use_pager) {
$conf['use_pager'] = $pv->use_pager;
$conf['pager_id'] = $pv->pager_id;
}
if ($pv->allow_nodes_per_page) {
$conf['nodes_per_page'] = $pv->nodes_per_page;
}
if ($pv->allow_offset) {
$conf['offset'] = $pv->offset;
}
if ($pv->allow_url_override) {
$conf['url'] = $pv->url;
}
if ($pv->allow_url_from_panel) {
$conf['url_from_panel'] = $pv->url_from_panel;
}
}
$form['title'] = array(
'#type' => 'hidden',
'#value' => $pv->title,
);
$form['name'] = array(
'#type' => 'hidden',
'#value' => $id,
);
foreach ($pv->contexts as $id => $data) {
if ($data['type'] == 'user') {
$form['arguments'][$id] = array(
'#type' => 'textfield',
'#default_value' => $conf['arguments'][$id],
'#title' => $data['label'],
);
}
}
// Provide form gadgets only on the things that th euser can change.
if ($pv->allow_type) {
$form['view_type'] = array(
'#type' => 'select',
'#default_value' => $conf['view_type'],
'#title' => t('View type'),
'#description' => t('Select which type of the view to display.'),
'#options' => array(
'page' => t('Page'),
'block' => t('Block'),
'embed' => t('Embedded'),
),
);
}
if ($pv->allow_link_to_view) {
$form['link_to_view'] = array(
'#type' => 'checkbox',
'#default_value' => $conf['link_to_view'],
'#title' => t('Link title to view'),
'#description' => t('If checked, the title will be a link to the view.'),
);
}
if ($pv->allow_more_link) {
$form['more_link'] = array(
'#type' => 'checkbox',
'#default_value' => $conf['more_link'],
'#title' => t('Provide a "more" link that links to the view'),
'#description' => t('This is independent of any more link that may be provided by the view itself; if you see two more links, turn this one off. Views will only provide a more link if using the "block" type, however, so if using embed, use this one.'),
);
if ($pv->allow_more_text) {
$form['more_text'] = array(
'#type' => 'textfield',
'#default_value' => $conf['more_text'],
'#title' => t('"More" link text'),
'#description' => t('If you activated panels own "more" link above, this allows you to customize the text to display.'),
);
}
}
if ($pv->allow_feed_icons) {
$form['feed_icons'] = array(
'#type' => 'checkbox',
'#default_value' => $conf['feed_icons'],
'#title' => t('Display feed icons'),
'#description' => t('If checked, any feed icons provided by this view will be displayed.'),
);
}
if ($pv->allow_use_pager) {
$form['pager_aligner_start'] = array(
'#value' => '<div class="option-text-aligner">',
);
$form['use_pager'] = array(
'#type' => 'checkbox',
'#title' => t('Use pager'),
'#default_value' => $conf['use_pager'],
'#id' => 'use-pager-checkbox',
);
$form['pager_id'] = array(
'#type' => 'textfield',
'#default_value' => $conf['pager_id'],
'#title' => t('Pager ID'),
'#size' => 4,
'#id' => 'use-pager-textfield',
);
$form['pager_aligner_stop'] = array(
'#value' => '</div><div style="clear: both; padding: 0; margin: 0"></div>',
);
}
if ($pv->allow_nodes_per_page) {
$form['nodes_per_page'] = array(
'#type' => 'textfield',
'#default_value' => $conf['nodes_per_page'],
'#title' => t('Num posts'),
'#size' => 4,
'#description' => t('Select the number of posts to display, or 0 to display all results.'),
);
}
if ($pv->allow_offset) {
$form['offset'] = array(
'#type' => 'textfield',
'#default_value' => $conf['offset'],
'#title' => t('Offset'),
'#size' => 4,
'#description' => t('Enter the item number to start at; this option only works if "use pager" is not checked. Enter 0 to start at the first item, 1 to start at the second, etc.'),
);
}
if ($pv->allow_url_override) {
// TODO: Because javascript in the dialogs is kind of weird, dependent checkboxes
// don't work right for external modules. This needs fixing in panels itself.
$form['url'] = array(
'#type' => 'textfield',
'#default_value' => $conf['url'],
'#title' => t('Override URL'),
'#size' => 30,
'#description' => t('If this is set, override the View URL; this can sometimes be useful to set to the panel URL.') . ' ' . t('You may use $arg to pass panel arguments to the view.'),
);
}
if ($pv->allow_url_from_panel) {
$form['url_from_panel'] = array(
'#type' => 'checkbox',
'#title' => t('Set view URL to panel URL'),
'#default_value' => $conf['url_from_panel'],
);
}
return $form;
}