Skip to content
Snippets Groups Projects
Commit 1888fb9a authored by Earl Miles's avatar Earl Miles
Browse files

Support for Panels admin UI.

parent 9106a36c
No related branches found
No related tags found
No related merge requests found
......@@ -7,26 +7,24 @@
*/
function delegator_node_edit_delegator_tasks() {
return array(
'node_edit' => array(
// This is a 'page' task and will fall under the page admin UI
'task type' => 'page',
'title' => t('Node edit'),
'description' => t('The node edit task allows you to control what handler will handle the job of editing a node at the path <em>node/%node/edit</em>. It also handles the node add page at node/add/%type. If no handler is set or matches the criteria, the default Drupal node renderer will be used. Please note that some modules sufficiently customize their node add and edit procedure that this may not successfully override adding or editing of all types.'),
'admin title' => 'Node edit', // translated by menu system
'admin description' => 'Overrides for the built in node edit handler at <em>node/%node/edit</em>.',
'admin path' => 'node/%node/edit',
// Menu hooks so that we can alter the node/%node menu entry to point to us.
'hook menu' => 'delegator_node_edit_menu',
'hook menu alter' => 'delegator_node_edit_menu_alter',
// This is task uses 'context' handlers and must implement these to give the
// handler data it needs.
'handler type' => 'context',
'get arguments' => 'delegator_node_edit_get_arguments',
'get context placeholders' => 'delegator_node_edit_get_contexts',
),
// This is a 'page' task and will fall under the page admin UI
'task type' => 'page',
'title' => t('Node edit'),
'description' => t('The node edit task allows you to control what handler will handle the job of editing a node at the path <em>node/%node/edit</em>. It also handles the node add page at node/add/%type. If no handler is set or matches the criteria, the default Drupal node renderer will be used. Please note that some modules sufficiently customize their node add and edit procedure that this may not successfully override adding or editing of all types.'),
'admin title' => 'Node edit', // translated by menu system
'admin description' => 'Overrides for the built in node edit handler at <em>node/%node/edit</em>.',
'admin path' => 'node/%node/edit',
// Menu hooks so that we can alter the node/%node menu entry to point to us.
'hook menu' => 'delegator_node_edit_menu',
'hook menu alter' => 'delegator_node_edit_menu_alter',
// This is task uses 'context' handlers and must implement these to give the
// handler data it needs.
'handler type' => 'context',
'get arguments' => 'delegator_node_edit_get_arguments',
'get context placeholders' => 'delegator_node_edit_get_contexts',
);
}
......
......@@ -16,36 +16,37 @@
*/
function delegator_term_view_delegator_tasks() {
return array(
'term_view' => array(
// This is a 'page' task and will fall under the page admin UI
'task type' => 'page',
'title' => t('Taxonomy term view'),
'description' => t('Control what handles the job of displaying a term at taxonomy/term/%term.'),
'admin title' => 'Taxonomy term view', // translated by menu system
'admin description' => 'Overrides for the built in taxonomy term handler at <em>taxonomy/term/%term</em>.',
'admin path' => 'taxonomy/term/%term',
// Menu hooks so that we can alter the term/%term menu entry to point to us.
'hook menu' => 'delegator_term_view_menu',
'hook menu alter' => 'delegator_term_view_menu_alter',
// This is task uses 'context' handlers and must implement these to give the
// handler data it needs.
'handler type' => 'context',
'get arguments' => 'delegator_term_view_get_arguments',
'get context placeholders' => 'delegator_term_view_get_contexts',
// Allow additional operations
'operations' => array(
array(
'title' => t('Task handlers'),
'href' => "admin/build/delegator/term_view",
),
array(
'title' => t('Settings'),
'href' => "admin/build/delegator/term_view/settings",
),
// This is a 'page' task and will fall under the page admin UI
'task type' => 'page',
'title' => t('Taxonomy term view'),
'description' => t('Control what handles the job of displaying a term at taxonomy/term/%term.'),
'admin title' => 'Taxonomy term view', // translated by menu system
'admin description' => 'Overrides for the built in taxonomy term handler at <em>taxonomy/term/%term</em>.',
'admin path' => 'taxonomy/term/%term',
// Menu hooks so that we can alter the term/%term menu entry to point to us.
'hook menu' => 'delegator_term_view_menu',
'hook menu alter' => 'delegator_term_view_menu_alter',
// Provide a setting to the primary settings UI for Panels
'admin settings' => 'delegator_term_view_admin_settings',
// This is task uses 'context' handlers and must implement these to give the
// handler data it needs.
'handler type' => 'context',
'get arguments' => 'delegator_term_view_get_arguments',
'get context placeholders' => 'delegator_term_view_get_contexts',
// Allow additional operations
'operations' => array(
array(
'title' => t('Task handlers'),
'href' => "admin/build/delegator/term_view",
),
array(
'title' => t('Settings'),
'href' => "admin/build/delegator/term_view/settings",
),
),
);
......@@ -150,6 +151,11 @@ function delegator_term_view_get_contexts($task, $subtask_id) {
function delegator_term_view_settings() {
$task = delegator_get_task('term_view');
delegator_set_trail($task);
$form = array();
// This passes thru because the setting can also appear on the main Panels
// settings form.
delegator_term_view_admin_settings($form);
$form['delegator_term_view_type'] = array(
'#type' => 'radios',
'#title' => t('Allow multiple terms'),
......@@ -160,3 +166,16 @@ function delegator_term_view_settings() {
return system_settings_form($form);
}
/**
* Provide a setting to the Panels administrative form.
*/
function delegator_term_view_admin_settings(&$form) {
$form['delegator_term_view_type'] = array(
'#type' => 'radios',
'#title' => t('Allow multiple terms on taxonomy/term/%term'),
'#options' => array('single' => t('Single term'), 'multiple' => t('Multiple terms')),
'#description' => t('By default, Drupal allows multiple terms as an argument by separating them with commas or plus signs. If you set this to single, that feature will be disabled.'),
'#default_value' => variable_get('delegator_term_view_type', 'multiple'),
);
}
......@@ -13,6 +13,7 @@
function views_content_views_panes_ctools_content_types() {
return array(
'title' => t('View panes'),
'admin settings' => 'views_content_admin_form',
'js' => array(drupal_get_path('module', 'ctools') . '/js/dependent.js'),
);
}
......
<?php
// $Id$
/**
* @file panels_views.module
*
* Provides views as panels content, configurable by the administrator.
* Each view provided as panel content must be configured in advance,
* but once configured, building panels with views is a little bit simpler.
*/
function views_content_admin_page() {
$form['ctools_content_all_views'] = array(
'#type' => 'checkbox',
'#title' => t('Make all views available as panes'),
'#description' => t("If checked, all views will be made available as content panes to be added to content types. If not checked, only Views that have a 'Content pane' display will be available as content panes."),
'#default_value' => variable_get('ctools_content_all_views', TRUE),
);
return system_settings_form($form);
}
\ No newline at end of file
......@@ -15,18 +15,16 @@
function views_content_menu() {
$items = array();
$base = array(
'access arguments' => array('administer views content plugin'),
'file' => 'views_content.admin.inc',
);
$items['admin/panels/views'] = array(
'title' => 'Views panes',
'type' => MENU_NORMAL_ITEM,
'page callback' => 'drupal_get_form',
'page arguments' => array('views_content_admin_page'),
'description' => 'Configure Views to be used as panes within panel displays.',
) + $base;
if (!module_exists('panels')) {
$items['admin/settings/content-views'] = array(
'title' => 'Views panes',
'access arguments' => array('administer views content plugin'),
'page callback' => 'drupal_get_form',
'page arguments' => array('views_content_admin_page'),
'description' => 'Configure Views to be used as CTools content.',
'type' => MENU_NORMAL_ITEM,
) + $base;
}
return $items;
}
......@@ -74,3 +72,22 @@ function views_content_views_api() {
'path' => drupal_get_path('module', 'views_content') . '/plugins/views',
);
}
/**
* Page callback to provide the basic administration form.
*/
function views_content_admin_page() {
$form = array();
views_content_admin_form($form);
return system_settings_form($form);
}
function views_content_admin_form(&$form) {
$form['ctools_content_all_views'] = array(
'#type' => 'checkbox',
'#title' => t('Make all views available as panes'),
'#description' => t("If checked, all views will be made available as content panes to be added to content types. If not checked, only Views that have a 'Content pane' display will be available as content panes. Uncheck this if you want to be able to more carefully control what view content is available to users using the panels layout UI."),
'#default_value' => variable_get('ctools_content_all_views', TRUE),
);
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment