diff -upr /root/panelizer-6.x/includes/admin.inc panelizer/includes/admin.inc
--- /root/panelizer-6.x/includes/admin.inc 2011-02-26 02:40:37.000000000 -0500
+++ panelizer/includes/admin.inc 2011-05-18 16:22:24.000000000 -0400
@@ -1,6 +1,4 @@
disabled)) {
- $form['warning']['task'] = array(
- '#prefix' => '
',
- '#value' => t('The node template page is currently not enabled in page manager. You must enable this for Panelizer to be able to panelize nodes.'),
- '#suffix' => '
',
- );
+ drupal_set_message('The node template page is currently not enabled in page manager. You must enable this for Panelizer to be able to panelize nodes.', 'warning');
}
$handler = page_manager_load_task_handler($task, '', 'node_view_panelizer');
if (!empty($handler->disabled)) {
- $form['warning']['handler'] = array(
- '#prefix' => '',
- '#value' => t('The panelizer variant on the node template page is currently not enabled in page manager. You must enable this for Panelizer to be able to panelize nodes.'),
- '#suffix' => '
',
- );
+ drupal_set_message('The panelizer variant on the node template page is currently not enabled in page manager. You must enable this for Panelizer to be able to panelize nodes.', 'warning');
}
$form['types'] = array('#tree' => TRUE);
@@ -42,17 +31,18 @@ function panelizer_settings_page_form(&$
'#theme' => 'panelizer_node_settings_page_form',
);
- $types = node_get_types('names');
- drupal_alter('panelizer_default_types', $types, 'node');
+ $types = node_type_get_names();
+ $context = 'node';
+ drupal_alter('panelizer_default_types', $types, $context);
$settings = variable_get('panelizer_defaults', array());
foreach ($types as $type => $title) {
- $base_id = str_replace(array('][', '_', ' '), '-', 'edit-types-node-' . $type);
+ $base_id = str_replace(array('][', '_', ' '), '-', '#edit-types-node-' . $type);
+ $base_url = 'admin/config/content/panelizer/node/' . $type;
$form['types']['node'][$type]['title'] = array(
- '#value' => $title,
- // '#markup' => $title, // for d7 port
+ '#markup' => $title,
);
$form['types']['node'][$type]['status'] = array(
@@ -63,103 +53,107 @@ function panelizer_settings_page_form(&$
$form['types']['node'][$type]['default'] = array(
'#type' => 'checkbox',
'#default_value' => !empty($settings['node'][$type]['default']),
- '#process' => array('ctools_dependent_process'),
- '#dependency' => array($base_id . '-status' => array(TRUE)),
+ '#states' => array(
+ 'visible' => array(
+ $base_id . '-status' => array('checked' => TRUE),
+ ),
+ ),
);
$form['types']['node'][$type]['choice'] = array(
'#type' => 'checkbox',
'#default_value' => !empty($settings['node'][$type]['choice']),
- '#process' => array('ctools_dependent_process'),
- '#dependency' => array($base_id . '-status' => array(TRUE)),
- '#access' => FALSE, // Allowing a choice is curently disabled
+ '#status' => array(
+ 'visible' => array(
+ $base_id . '-status' => array('checked' => TRUE),
+ ),
+ ),
+ '#access' => FALSE, // Allowing a choice is currently disabled
);
- $base_url = 'admin/settings/panelizer/node/' . $type;
-
$form['types']['node'][$type]['links'] = array(
'#prefix' => '',
'#suffix' => '
',
);
- if (!empty($settings['node'][$type]['status'])) {
- // add links
- $links = array(
- 'settings' => array(
- 'title' => t('allowed content'),
- 'href' => $base_url . '/allowed',
- ),
- );
-
- $form['types']['node'][$type]['links']['basic'] = array(
- '#type' => 'item',
- '#input' => TRUE, // necessary to fake the #process
- '#value' => theme('links', $links, array('class' => 'links inline')),
- '#id' => $base_id . '-links-basic',
- '#process' => array('ctools_dependent_process'),
- '#dependency' => array($base_id . '-status' => array(TRUE)),
- );
- }
+ // Panelize is on all content types get this option
+ $links = array(
+ 'settings' => array(
+ 'title' => t('allowed content'),
+ 'href' => $base_url . '/allowed',
+ ),
+ );
- if (!empty($settings['node'][$type]['default'])) {
- // add links
- $links = array(
- 'settings' => array(
- 'title' => t('settings'),
- 'href' => $base_url . '/settings',
- ),
- 'context' => array(
- 'title' => t('context'),
- 'href' => $base_url . '/context',
- ),
- 'layout' => array(
- 'title' => t('layout'),
- 'href' => $base_url . '/layout',
+ $form['types']['node'][$type]['links']['basic'] = array(
+ '#type' => 'item',
+ '#title' => theme('links', array(
+ 'links' => $links,
+ 'attributes' => array('class' => 'links inline'),
+ )),
+ '#states' => array(
+ 'visible' => array(
+ $base_id . '-status' => array('checked' => TRUE),
),
- 'content' => array(
- 'title' => t('content'),
- 'href' => $base_url . '/content',
- ),
- );
+ ),
+ );
- $form['types']['node'][$type]['links']['default'] = array(
- '#type' => 'item',
- '#input' => TRUE, // necessary to fake the #process
- '#value' => theme('links', $links, array('class' => 'links inline')),
- '#id' => $base_id . '-links-default',
- '#process' => array('ctools_dependent_process'),
- '#dependency_count' => 2,
- '#dependency' => array(
- $base_id . '-default' => array(TRUE),
- $base_id . '-choice' => array(FALSE),
- ),
- );
+ // Panelize is enabled and a default panel will be provided
+ $links = array(
+ 'settings' => array(
+ 'title' => t('settings'),
+ 'href' => $base_url . '/settings',
+ ),
+ 'context' => array(
+ 'title' => t('context'),
+ 'href' => $base_url . '/context',
+ ),
+ 'layout' => array(
+ 'title' => t('layout'),
+ 'href' => $base_url . '/layout',
+ ),
+ 'content' => array(
+ 'title' => t('content'),
+ 'href' => $base_url . '/content',
+ ),
+ );
- $links = array(
- 'list' => array(
- 'title' => t('list'),
- 'href' => $base_url . '/list',
+ $form['types']['node'][$type]['links']['default'] = array(
+ '#type' => 'item',
+ '#title' => theme('links', array(
+ 'links' => $links,
+ 'attributes' => array('class' => 'links inline'),
+ )),
+ '#states' => array(
+ 'visible' => array(
+ $base_id . '-default' => array('checked' => TRUE),
),
- );
+ ),
+ );
+
+ /*
+ $links = array(
+ 'list' => array(
+ 'title' => t('list'),
+ 'href' => $base_url . '/list',
+ ),
+ );
- $form['types']['node'][$type]['links']['default2'] = array(
- '#type' => 'item',
- '#input' => TRUE, // necessary to fake the #process
- '#value' => theme('links', $links, array('class' => 'links inline')),
- '#id' => $base_id . '-links-default2',
- '#process' => array('ctools_dependent_process'),
- '#dependency_count' => 2,
- '#dependency' => array(
- $base_id . '-default' => array(TRUE),
- $base_id . '-choice' => array(TRUE),
+ $form['types']['node'][$type]['links']['default2'] = array(
+ '#type' => 'item',
+ '#title' => theme('links', array(
+ 'links' => $links,
+ 'attributes' => array('class' => 'links inline'),
+ )),
+ '#states' => array(
+ 'visible' => array(
+ $base_id . '-status' => array('checked' => TRUE),
+ $base_id . '-choice' => array('checked' => TRUE),
),
- );
- }
+ ),
+ );
+ */
}
- // Add 'user' settings
-
-
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
@@ -173,8 +167,8 @@ function panelizer_settings_page_form(&$
*
* We want our checkboxes to show up in a table.
*/
-function theme_panelizer_node_settings_page_form($element) {
- $output = '';
+function theme_panelizer_node_settings_page_form($variables) {
+ $element = $variables['form'];
// Render the 'node' table
$header = array(
@@ -194,12 +188,10 @@ function theme_panelizer_node_settings_p
);
}
- $output .= theme('table', $header, $rows);
-
- // Render the 'user' table
+ $output = theme('table', array('header' => $header, 'rows' => $rows));
// Render everything else
- $output .= drupal_render($element);
+ //$output .= drupal_render_children($element);
return $output;
}
@@ -226,10 +218,6 @@ function panelizer_allowed_content_page(
return MENU_NOT_FOUND;
}
- // Drupal kills our breadcrumb. Put it back.
- ctools_include('menu');
- ctools_menu_set_trail_parent('admin/settings/panelizer');
-
ctools_include('common', 'panels');
return drupal_get_form('panels_common_settings', 'panelizer_' . $type . ':' . $key);
}
@@ -250,18 +238,13 @@ function panelizer_default_settings_page
return MENU_NOT_FOUND;
}
- // Drupal kills our breadcrumb. Put it back.
- ctools_include('menu');
- ctools_menu_set_trail_parent('admin/settings/panelizer');
-
$form_state = array(
'panelizer' => &$panelizer,
'no_redirect' => TRUE,
);
- ctools_include('form');
ctools_include('common', 'panelizer');
- $output = ctools_build_form('panelizer_settings_form', $form_state);
+ $output = drupal_build_form('panelizer_settings_form', $form_state);
if (!empty($form_state['executed'])) {
drupal_set_message(t('The settings have been updated.'));
ctools_include('export');
@@ -283,10 +266,6 @@ function panelizer_default_context_page(
return MENU_NOT_FOUND;
}
- // Drupal kills our breadcrumb. Put it back.
- ctools_include('menu');
- ctools_menu_set_trail_parent('admin/settings/panelizer');
-
$form_state = array(
'panelizer' => &$panelizer,
'panelizer type' => 'default',
@@ -295,9 +274,8 @@ function panelizer_default_context_page(
'no_redirect' => TRUE,
);
- ctools_include('form');
ctools_include('common', 'panelizer');
- $output = ctools_build_form('panelizer_default_context_form', $form_state);
+ $output = drupal_build_form('panelizer_default_context_form', $form_state);
if (!empty($form_state['executed'])) {
if (!empty($form_state['clicked_button']['#write'])) {
drupal_set_message(t('The settings have been updated.'));
@@ -324,10 +302,6 @@ function panelizer_default_layout_page($
return MENU_NOT_FOUND;
}
- // Drupal kills our breadcrumb. Put it back.
- ctools_include('menu');
- ctools_menu_set_trail_parent('admin/settings/panelizer');
-
$display = panelizer_load_display($panelizer);
ctools_include('context');
@@ -357,42 +331,5 @@ function panelizer_default_layout_page($
*/
function panelizer_default_content_page($type, $key, $name) {
$panelizer = panelizer_load_default($type, $key, $name);
- if (empty($panelizer)) {
- return MENU_NOT_FOUND;
- }
-
- // Drupal kills our breadcrumb. Put it back.
- ctools_include('menu');
- ctools_menu_set_trail_parent('admin/settings/panelizer');
-
- $cache = panels_edit_cache_get('panelizer:default:' . $type . ':' . $key . ':' . $name);
-
- ctools_include('plugins', 'panels');
- ctools_include('display-edit', 'panels');
- ctools_include('context');
- $renderer = panels_get_renderer_handler('editor', $cache->display);
- $renderer->cache = $cache;
-
- $output = $renderer->edit();
- if (is_object($output)) {
- // The display was already saved, but if we were given a did, that
- // needs to be saved too.
- if ($panelizer->did != $output->did) {
- ctools_include('export');
- $panelizer->did = $output->did;
- // Ensure we don't try to write again:
- if (isset($panelizer->display)) {
- unset($panelizer->display);
- }
-
- ctools_export_crud_save('panelizer_defaults', $panelizer);
- }
- panels_edit_cache_clear($cache);
- drupal_goto($_GET['q']);
- }
-
- // Print this with theme('page') so that blocks are disabled while editing a display.
- // This is important because negative margins in common block layouts (i.e, Garland)
- // messes up the drag & drop.
- print theme('page', $output, FALSE);
+ return panelizer_edit_content($panelizer);
}
diff -upr /root/panelizer-6.x/includes/common.inc panelizer/includes/common.inc
--- /root/panelizer-6.x/includes/common.inc 2011-02-26 02:40:37.000000000 -0500
+++ panelizer/includes/common.inc 2011-05-17 13:39:40.000000000 -0400
@@ -1,6 +1,4 @@
'',
'#suffix' => '
',
- '#value' => theme('ctools_context_list', $panelizer, t('Summary of contexts'), $description),
+ '#value' => theme('ctools_context_list', array(
+ 'object' => $panelizer,
+ 'header' => array(),
+ '' => t('Summary of contexts'),
+ 'description' => $description,
+ )),
);
$form['submit'] = array(
@@ -143,4 +149,3 @@ function panelizer_default_context_form(
return $form;
}
-
diff -upr /root/panelizer-6.x/includes/node.inc panelizer/includes/node.inc
--- /root/panelizer-6.x/includes/node.inc 2011-02-26 02:40:37.000000000 -0500
+++ panelizer/includes/node.inc 2011-05-18 16:22:42.000000000 -0400
@@ -1,6 +1,4 @@
nid));
+ $panelizer = db_select('panelizer_node', 'pn')
+ ->fields('pn')
+ ->condition('nid', $node->nid)
+ ->execute()
+ ->fetchObject();
+
if ($panelizer && !empty($panelizer->did)) {
ctools_include('export');
$panelizer = ctools_export_unpack_object('panelizer_node', $panelizer);
@@ -116,9 +119,8 @@ function panelizer_edit_node_settings_pa
'no_redirect' => TRUE,
);
- ctools_include('form');
ctools_include('common', 'panelizer');
- $output = ctools_build_form($form_id, $form_state);
+ $output = drupal_build_form($form_id, $form_state);
if (!empty($form_state['executed'])) {
drupal_set_message(t('The settings have been updated.'));
panelizer_save_node_panelizer($panelizer);
@@ -128,6 +130,10 @@ function panelizer_edit_node_settings_pa
return $output;
}
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
function panelizer_panelize_node_form(&$form_state) {
$form = array();
@@ -161,9 +167,8 @@ function panelizer_edit_node_context_pag
'no_redirect' => TRUE,
);
- ctools_include('form');
ctools_include('common', 'panelizer');
- $output = ctools_build_form('panelizer_default_context_form', $form_state);
+ $output = drupal_build_form('panelizer_default_context_form', $form_state);
if (!empty($form_state['executed'])) {
if (!empty($form_state['clicked_button']['#write'])) {
drupal_set_message(t('The settings have been updated.'));
@@ -218,40 +223,7 @@ function panelizer_edit_node_layout_page
*/
function panelizer_edit_node_content_page($node) {
$panelizer = panelizer_load_node_panelizer($node);
- if (empty($panelizer)) {
- return MENU_NOT_FOUND;
- }
-
- $cache = panels_edit_cache_get('panelizer:node:' . $node->nid);
-
- ctools_include('plugins', 'panels');
- ctools_include('display-edit', 'panels');
- ctools_include('context');
- $renderer = panels_get_renderer_handler('editor', $cache->display);
- $renderer->cache = $cache;
-
- $output = $renderer->edit();
- if (is_object($output)) {
- // The display was already saved, but if we were given a did, that
- // needs to be saved too.
- if ($panelizer->did != $output->did) {
- ctools_include('export');
- $panelizer->did = $output->did;
- // Ensure we don't try to write again:
- if (isset($panelizer->display)) {
- unset($panelizer->display);
- }
-
- panelizer_save_node_panelizer($panelizer);
- }
- panels_edit_cache_clear($cache);
- drupal_goto($_GET['q']);
- }
-
- // Print this with theme('page') so that blocks are disabled while editing a display.
- // This is important because negative margins in common block layouts (i.e, Garland)
- // messes up the drag & drop.
- print theme('page', $output, FALSE);
+ return panelizer_edit_content($panelizer);
}
/**
@@ -271,80 +243,80 @@ function panelizer_get_default_display_n
$display->title = '';
$display->content = array();
$display->panels = array();
- $pane = new stdClass;
- $pane->pid = 'new-1';
- $pane->panel = 'center';
- $pane->type = 'node_content';
- $pane->subtype = 'node_content';
- $pane->shown = TRUE;
- $pane->access = array();
- $pane->configuration = array(
- 'links' => 1,
- 'page' => 1,
- 'no_extras' => 0,
- 'override_title' => 0,
- 'override_title_text' => '',
- 'identifier' => '',
- 'link' => 0,
- 'leave_node_title' => 0,
- 'context' => 'panelizer',
- 'build_mode' => 'full',
- );
- $pane->cache = array();
- $pane->style = array(
- 'settings' => NULL,
- );
- $pane->css = array();
- $pane->extras = array();
- $pane->position = 0;
- $display->content['new-1'] = $pane;
- $display->panels['center'][0] = 'new-1';
- $pane = new stdClass;
- $pane->pid = 'new-2';
- $pane->panel = 'center';
- $pane->type = 'node_comments';
- $pane->subtype = 'node_comments';
- $pane->shown = TRUE;
- $pane->access = array();
- $pane->configuration = array(
- 'mode' => '4',
- 'order' => '2',
- 'comments_per_page' => '50',
- 'context' => 'panelizer',
- 'override_title' => 0,
- 'override_title_text' => '',
- );
- $pane->cache = array();
- $pane->style = array(
- 'settings' => NULL,
- );
- $pane->css = array();
- $pane->extras = array();
- $pane->position = 1;
- $display->content['new-2'] = $pane;
- $display->panels['center'][1] = 'new-2';
- $pane = new stdClass;
- $pane->pid = 'new-3';
- $pane->panel = 'center';
- $pane->type = 'node_comment_form';
- $pane->subtype = 'node_comment_form';
- $pane->shown = TRUE;
- $pane->access = array();
- $pane->configuration = array(
- 'anon_links' => 1,
- 'context' => 'panelizer',
- 'override_title' => 0,
- 'override_title_text' => '',
- );
- $pane->cache = array();
- $pane->style = array(
- 'settings' => NULL,
- );
- $pane->css = array();
- $pane->extras = array();
- $pane->position = 2;
- $display->content['new-3'] = $pane;
- $display->panels['center'][2] = 'new-3';
+ $pane = new stdClass;
+ $pane->pid = 'new-1';
+ $pane->panel = 'center';
+ $pane->type = 'node_content';
+ $pane->subtype = 'node_content';
+ $pane->shown = TRUE;
+ $pane->access = array();
+ $pane->configuration = array(
+ 'links' => 1,
+ 'page' => 1,
+ 'no_extras' => 0,
+ 'override_title' => 0,
+ 'override_title_text' => '',
+ 'identifier' => '',
+ 'link' => 0,
+ 'leave_node_title' => 0,
+ 'context' => 'panelizer',
+ 'build_mode' => 'full',
+ );
+ $pane->cache = array();
+ $pane->style = array(
+ 'settings' => NULL,
+ );
+ $pane->css = array();
+ $pane->extras = array();
+ $pane->position = 0;
+ $display->content['new-1'] = $pane;
+ $display->panels['center'][0] = 'new-1';
+ $pane = new stdClass;
+ $pane->pid = 'new-2';
+ $pane->panel = 'center';
+ $pane->type = 'node_comments';
+ $pane->subtype = 'node_comments';
+ $pane->shown = TRUE;
+ $pane->access = array();
+ $pane->configuration = array(
+ 'mode' => '4',
+ 'order' => '2',
+ 'comments_per_page' => '50',
+ 'context' => 'panelizer',
+ 'override_title' => 0,
+ 'override_title_text' => '',
+ );
+ $pane->cache = array();
+ $pane->style = array(
+ 'settings' => NULL,
+ );
+ $pane->css = array();
+ $pane->extras = array();
+ $pane->position = 1;
+ $display->content['new-2'] = $pane;
+ $display->panels['center'][1] = 'new-2';
+ $pane = new stdClass;
+ $pane->pid = 'new-3';
+ $pane->panel = 'center';
+ $pane->type = 'node_comment_form';
+ $pane->subtype = 'node_comment_form';
+ $pane->shown = TRUE;
+ $pane->access = array();
+ $pane->configuration = array(
+ 'anon_links' => 1,
+ 'context' => 'panelizer',
+ 'override_title' => 0,
+ 'override_title_text' => '',
+ );
+ $pane->cache = array();
+ $pane->style = array(
+ 'settings' => NULL,
+ );
+ $pane->css = array();
+ $pane->extras = array();
+ $pane->position = 2;
+ $display->content['new-3'] = $pane;
+ $display->panels['center'][2] = 'new-3';
$display->hide_title = PANELS_TITLE_FIXED;
$display->title_pane = 'new-1';
@@ -369,7 +341,7 @@ function panelizer_get_base_context_node
'name' => 'node',
'identifier' => t('This node'),
'keyword' => 'node',
- 'context_settings' => array()
+ 'context_settings' => array(),
),
);
}
diff -upr /root/panelizer-6.x/includes/panelizer.pages_default.inc panelizer/includes/panelizer.pages_default.inc
--- /root/panelizer-6.x/includes/panelizer.pages_default.inc 2011-02-26 02:40:37.000000000 -0500
+++ panelizer/includes/panelizer.pages_default.inc 2011-05-17 13:39:55.000000000 -0400
@@ -1,13 +1,11 @@
'text',
'size' => 'big',
'description' => 'Any CSS the author provided for the panel.',
- 'default' => '',
),
'pipeline' => array(
'type' => 'varchar',
@@ -99,7 +101,7 @@ function panelizer_schema_1() {
'minimum_version' => 1,
'current_version' => 1,
),
-// 'create callback' => 'panelizer_export_create_callback',
+ // 'create callback' => 'panelizer_export_create_callback',
'save callback' => 'panelizer_export_save_callback',
'export callback' => 'panelizer_export_export_callback',
'delete callback' => 'panelizer_export_delete_callback',
@@ -142,17 +144,27 @@ function panelizer_schema_1() {
}
/**
- * Implementation of hook_install().
+ * Implements hook_install().
*/
function panelizer_install() {
- db_query("UPDATE {system} SET weight = 21 WHERE name = 'panelizer'");
- drupal_install_schema('panelizer');
+ // TODO Please review the conversion of this statement to the D7 database API syntax.
+ /* db_query("UPDATE {system} SET weight = 21 WHERE name = 'panelizer'") */
+ // Set the module weight so it can execute after Panels.
+ db_update('system')
+ ->fields(array(
+ 'weight' => 21,
+ ))
+ ->condition('name', 'panelizer')
+ ->execute();
}
/**
- * Implementation of hook_uninstall().
+ * Implements hook_uninstall().
*/
function panelizer_uninstall() {
- drupal_uninstall_schema('panelizer');
- db_query("DELETE FROM {variable} WHERE name like 'panelizer%%'");
+ // TODO Please review the conversion of this statement to the D7 database API syntax.
+ /* db_query("DELETE FROM {variable} WHERE name like 'panelizer%%'") */
+ // db_delete('variable')
+ // ->condition("name LIKE 'panelizer%%'", '')
+ // ->execute();
}
diff -upr /root/panelizer-6.x/panelizer.module panelizer/panelizer.module
--- /root/panelizer-6.x/panelizer.module 2011-02-26 02:40:37.000000000 -0500
+++ panelizer/panelizer.module 2011-05-18 16:32:09.000000000 -0400
@@ -1,7 +1,4 @@
array(
+ 'title' => t('administer panelizer'),
+ 'description' => t('TODO Add a description for \'administer panelizer\''),
+ ),
+ );
}
/**
- * Implements hook_theme()
+ * Implements hook_theme().
*/
function panelizer_theme() {
$items = array();
$items['panelizer_node_settings_page_form'] = array(
- 'arguments' => array('form' => NULL),
+ 'render element' => 'form',
'file' => 'includes/admin.inc',
);
@@ -31,7 +33,7 @@ function panelizer_theme() {
}
/**
- * Implementation of hook_menu().
+ * Implements hook_menu().
*/
function panelizer_menu() {
// Safety: go away if CTools is not at an appropriate version.
@@ -45,7 +47,7 @@ function panelizer_menu() {
'file' => 'includes/admin.inc',
);
- $items['admin/settings/panelizer'] = array(
+ $items['admin/config/content/panelizer'] = array(
'title' => 'Panelizer',
'description' => 'Configure panelizer availability and defaults',
'page callback' => 'drupal_get_form',
@@ -53,60 +55,60 @@ function panelizer_menu() {
'type' => MENU_NORMAL_ITEM,
) + $settings_base;
- $items['admin/settings/panelizer/%/%'] = array(
+ $items['admin/config/content/panelizer/%/%'] = array(
'title callback' => 'panelizer_default_title_callback',
- 'title arguments' => array(3, 4),
+ 'title arguments' => array(4, 5),
'page callback' => 'panelizer_allowed_content_page',
- 'page arguments' => array(3, 4),
+ 'page arguments' => array(4, 5),
'type' => MENU_CALLBACK,
) + $settings_base;
- $items['admin/settings/panelizer/%/%/allowed'] = array(
+ $items['admin/config/content/panelizer/%/%/allowed'] = array(
'title' => 'Available content',
'page callback' => 'panelizer_allowed_content_page',
- 'page arguments' => array(3, 4),
- 'type' => MENU_DEFAULT_LOCAL_TASK,
+ 'page arguments' => array(4, 5),
+ 'type' => MENU_NORMAL_ITEM,
'weight' => -10,
) + $settings_base;
- $items['admin/settings/panelizer/%/%/list'] = array(
+ $items['admin/config/content/panelizer/%/%/list'] = array(
'title' => 'List defaults',
'access callback' => 'panelizer_has_choice_callback',
- 'access arguments' => array(3, 4, ''),
+ 'access arguments' => array(4, 5, ''),
'page callback' => 'panelizer_default_list_page',
- 'page arguments' => array(3, 4),
+ 'page arguments' => array(4, 5),
'type' => MENU_LOCAL_TASK,
'weight' => -6,
) + $settings_base;
$tabs_base = array(
'access callback' => 'panelizer_has_no_choice_callback',
- 'access arguments' => array(3, 4),
- 'page arguments' => array(3, 4, 'default'),
+ 'access arguments' => array(4, 5),
+ 'page arguments' => array(4, 5, 'default'),
'type' => MENU_LOCAL_TASK,
'file' => 'includes/admin.inc',
);
- $items['admin/settings/panelizer/%/%/settings'] = array(
+ $items['admin/config/content/panelizer/%/%/settings'] = array(
'title' => 'Settings',
'page callback' => 'panelizer_default_settings_page',
'weight' => -5,
) + $tabs_base;
- $items['admin/settings/panelizer/%/%/context'] = array(
+ $items['admin/config/content/panelizer/%/%/context'] = array(
'title' => 'Contexts',
'page callback' => 'panelizer_default_context_page',
'weight' => -4,
) + $tabs_base;
- $items['admin/settings/panelizer/%/%/layout'] = array(
+ $items['admin/config/content/panelizer/%/%/layout'] = array(
'title' => 'Layout',
'page callback' => 'panelizer_default_layout_page',
'weight' => -3,
) + $tabs_base;
- $items['admin/settings/panelizer/%/%/content'] = array(
+ $items['admin/config/content/panelizer/%/%/content'] = array(
'title' => 'Content',
'page callback' => 'panelizer_default_content_page',
'weight' => -2,
@@ -114,39 +116,39 @@ function panelizer_menu() {
$subtabs_base = array(
'access callback' => 'panelizer_has_choice_callback',
- 'access arguments' => array(3, 4, 5),
- 'page arguments' => array(3, 4, 5),
+ 'access arguments' => array(4, 5, 6),
+ 'page arguments' => array(4, 5, 6),
'type' => MENU_LOCAL_TASK,
'file' => 'includes/admin.inc',
);
- $items['admin/settings/panelizer/%/%/%'] = array(
+ $items['admin/config/content/panelizer/%/%/%'] = array(
'title' => 'Settings',
'page callback' => 'panelizer_default_settings_page',
'title callback' => 'panelizer_default_name_title_callback',
'type' => MENU_CALLBACK,
) + $subtabs_base;
- $items['admin/settings/panelizer/%/%/%/settings'] = array(
+ $items['admin/config/content/panelizer/%/%/%/settings'] = array(
'title' => 'Settings',
'page callback' => 'panelizer_default_settings_page',
- 'type' => MENU_DEFAULT_LOCAL_TASK,
+ 'type' => MENU_NORMAL_ITEM,
'weight' => -5,
) + $subtabs_base;
- $items['admin/settings/panelizer/%/%/%/context'] = array(
+ $items['admin/config/content/panelizer/%/%/%/context'] = array(
'title' => 'Contexts',
'page callback' => 'panelizer_default_context_page',
'weight' => -4,
) + $subtabs_base;
- $items['admin/settings/panelizer/%/%/%/layout'] = array(
+ $items['admin/config/content/panelizer/%/%/%/layout'] = array(
'title' => 'Layout',
'page callback' => 'panelizer_default_layout_page',
'weight' => -3,
) + $subtabs_base;
- $items['admin/settings/panelizer/%/%/%/content'] = array(
+ $items['admin/config/content/panelizer/%/%/%/content'] = array(
'title' => 'Content',
'page callback' => 'panelizer_default_content_page',
'weight' => -2,
@@ -172,7 +174,7 @@ function panelizer_menu() {
$items['node/%node/panelizer/settings'] = array(
'title' => 'Settings',
'page callback' => 'panelizer_edit_node_settings_page',
- 'type' => MENU_DEFAULT_LOCAL_TASK,
+ 'type' => MENU_NORMAL_ITEM,
'weight' => 11,
) + $base;
@@ -225,7 +227,7 @@ function panelizer_edit_node_callback($n
function panelizer_default_title_callback($type, $key) {
switch ($type) {
case 'node':
- $name = node_get_types('name', $key);
+ $name = node_type_get_name($key);
return check_plain($name);
case 'user':
}
@@ -264,11 +266,51 @@ function panelizer_has_no_choice_callbac
return !empty($settings[$type][$key]['status']) && !empty($settings[$type][$key]['default']) && empty($settings[$type][$key]['choice']);
}
-// ---------------------------------------------------------------------------
-// Node hooks
+/**
+ * Implements hook_node_view. This code was taken from the panels_node module and adapted to work with panelizer
+ */
+function panelizer_node_view($node, $view_mode, $lang) {
+
+ static $rendering = array();
+
+ // Prevent loops if someone foolishly puts the node inside itself:
+ if (!empty($rendering[$node->nid])) {
+ return $node;
+ }
+
+ $rendering[$node->nid] = TRUE;
+ ctools_include('plugins', 'panels');
+ if ($view_mode == 'teaser') {
+ // Because our teasier is never the same as our content, *always* provide
+ // the read more flag.
+ $node->readmore = TRUE;
+ }
+ else {
+ ctools_include('node', 'panelizer');
+ ctools_include('plugins', 'panels');
+ ctools_include('context');
+
+ $panelizer = panelizer_load_node_panelizer($node);
+
+ if (!empty($panelizer)) {
+ if ($panelizer->no_blocks) {
+ ctools_set_no_blocks(FALSE);
+ }
+ $display = panelizer_load_display($panelizer);
+ $display->css_id = $panelizer->css_id;
+ $display->context = panelizer_get_contexts($panelizer, $node);
+ $renderer = panels_get_renderer($panelizer->pipeline, $display);
+ $node->content['body'] = array(
+ '#markup' => panels_render_display($display, $renderer),
+ '#weight' => 0,
+ );
+ }
+ }
-// @todo -- need a nodeapi hook for insert/update so that node_save() can work
-// as expected if panelizer settings are attached to the node.
+ unset($rendering[$node->nid]);
+ return $node;
+
+}
// ---------------------------------------------------------------------------
// Panelizer object access routines
@@ -342,7 +384,7 @@ function panelizer_load_default_by_name(
* to them. This fetches the display, if there is one.
*/
function panelizer_load_default($type, $key, $name, $default_anyway = FALSE) {
- $load_name = $type . ':' . $key. ':' . $name;
+ $load_name = $type . ':' . $key . ':' . $name;
return _panelizer_load_default($type, $key, $name, $load_name, $default_anyway);
}
@@ -460,7 +502,11 @@ function panelizer_export_delete_callbac
panels_delete_display($object->did);
}
- db_query("DELETE FROM {panelizer_defaults} WHERE name = '%s'", $object->name);
+ // TODO Please review the conversion of this statement to the D7 database API syntax.
+ /* db_query("DELETE FROM {panelizer_defaults} WHERE name = '%s'", $object->name) */
+ db_delete('panelizer_defaults')
+ ->condition('name', $object->name)
+ ->execute();
}
// ---------------------------------------------------------------------------
@@ -541,7 +587,7 @@ function panelizer_context_cache_clear($
function panelizer_panels_cache_get($argument) {
ctools_include('object-cache');
list($type, $key) = explode(':', $argument, 2);
- $cache = ctools_object_cache_get('panelizer_display_cache', $type . ':' .$key);
+ $cache = ctools_object_cache_get('panelizer_display_cache', $type . ':' . $key);
if (!empty($cache)) {
$cache->cached = TRUE;
switch ($type) {
@@ -594,7 +640,7 @@ function panelizer_panels_cache_get($arg
function panelizer_panels_cache_set($argument, $cache) {
list($type, $key) = explode(':', $argument, 2);
ctools_include('object-cache');
- ctools_object_cache_set('panelizer_display_cache', $type . ':' .$key, $cache);
+ ctools_object_cache_set('panelizer_display_cache', $type . ':' . $key, $cache);
}
/**
@@ -603,7 +649,7 @@ function panelizer_panels_cache_set($arg
function panelizer_panels_cache_clear($argument, $cache) {
list($type, $key) = explode(':', $argument, 2);
ctools_include('object-cache');
- ctools_object_cache_clear('panelizer_display_cache', $type . ':' .$key);
+ ctools_object_cache_clear('panelizer_display_cache', $type . ':' . $key);
}
/**
@@ -663,7 +709,7 @@ function panelizer_get_contexts($paneliz
// Contrib module hooks to provide needed functionality.
/**
- * Implementation of hook_ctools_plugin_directory() to let the system know
+ * Implements hook_ctools_plugin_directory() to let the system know().
* where our task_handler plugins are.
*/
function panelizer_ctools_plugin_directory($owner, $plugin_type) {
@@ -673,7 +719,7 @@ function panelizer_ctools_plugin_directo
}
/**
- * Implementation of hook_ctools_plugin_api().
+ * Implements hook_ctools_plugin_api().
*/
function panelizer_ctools_plugin_api($module, $api) {
if ($module == 'page_manager' && $api == 'pages_default') {
@@ -685,7 +731,7 @@ function panelizer_ctools_plugin_api($mo
}
/**
- * Implementation of hook_export_node_alter()
+ * Implements hook_export_node_alter().
*
* Integrate with export.module for saving panel_nodes into code.
*/
@@ -694,7 +740,7 @@ function panelizer_export_node_alter(&$n
}
/**
- * Implementation of hook_panelizer_defaults_alter
+ * Implements hook_panelizer_defaults_alter().
*
* Remove the panels node because there is no point to panelizing it.
*/
@@ -709,3 +755,49 @@ function panelizer_panelizer_default_typ
case 'user':
}
}
+
+function panelizer_edit_content($panelizer) {
+ if (!is_object($panelizer)) {
+ return MENU_NOT_FOUND;
+ }
+
+ if (!empty($panelizer->nid)) {
+ $cache = panels_edit_cache_get('panelizer:node:' . $panelizer->nid);
+ } else if (is_numeric($panelizer->did)) {
+ $panelizer->display = panels_load_display($panelizer->did);
+ }
+ $cache = panels_edit_cache_get_default($panelizer->display, $panelizer->panelizer_type);
+ } else {
+ return;
+ }
+
+ ctools_include('plugins', 'panels');
+ ctools_include('display-edit', 'panels');
+ ctools_include('context');
+ $renderer = panels_get_renderer_handler('editor', $cache->display);
+ $renderer->cache = $cache;
+
+ $output = $renderer->edit();
+ if (is_object($output)) {
+ // The display was already saved, but if we were given a did, that
+ // needs to be saved too.
+
+ if ($panelizer->did != $output->did) {
+ ctools_include('export');
+ $panelizer->did = $output->did;
+ // Ensure we don't try to write again:
+ if (isset($panelizer->display)) {
+ unset($panelizer->display);
+ }
+
+ panelizer_save_node_panelizer($panelizer);
+ }
+ panels_edit_cache_clear($cache);
+ drupal_goto($_GET['q']);
+ }
+
+ ctools_set_no_blocks(FALSE);
+ drupal_set_page_content($output);
+ $page = element_info('page');
+ return $page;
+}
diff -upr /root/panelizer-6.x/plugins/task_handlers/panelizer_node.inc panelizer/plugins/task_handlers/panelizer_node.inc
--- /root/panelizer-6.x/plugins/task_handlers/panelizer_node.inc 2011-02-26 02:40:37.000000000 -0500
+++ panelizer/plugins/task_handlers/panelizer_node.inc 2011-05-17 16:33:29.000000000 -0400
@@ -1,6 +1,4 @@
'context',
// may NOT be added up front.
'visible' => FALSE,
-
// Administrative fields.
'title' => t('Panelizer'),
- 'admin summary' =>'panelizer_panelizer_task_admin_summary',
+ 'admin summary' => 'panelizer_panelizer_task_admin_summary',
'operations' => array(),
-
// Callback to render the data.
'render' => 'panelizer_panelizer_task_render',
);
+/**
+ * @todo Please document this function.
+ * @see http://drupal.org/node/1354
+ */
function panelizer_panelizer_task_admin_summary($handler, $task, $subtask, $page, $show_title = TRUE) {
$output = '';
@@ -46,12 +46,18 @@ function panelizer_panelizer_task_admin_
$access = t('This variant will be selected if the node being viewed is panelized. This variant must be enabled and selected for panelizer to work!');
$rows[] = array(
- array('class' => t('page-summary-label'), 'data' => t('Selection rule')),
- array('class' => t('page-summary-data'), 'data' => $access),
+ array(
+ 'class' => t('page-summary-label'),
+ 'data' => t('Selection rule'),
+ ),
+ array(
+ 'class' => t('page-summary-data'),
+ 'data' => $access,
+ ),
array('class' => t('page-summary-operation'), ''),
);
- $output .= theme('table', array(), $rows, array('class' => 'page-manager-handler-summary'));
+ $output .= theme('table', array('header' => array(), 'rows' => $rows, 'attributes' => array('class' => 'page-manager-handler-summary')));
$output .= '';
return $output;
diff -upr /root/panelizer-6.x/README.txt panelizer/README.txt
--- /root/panelizer-6.x/README.txt 2011-02-26 02:40:37.000000000 -0500
+++ panelizer/README.txt 2011-05-17 13:39:18.000000000 -0400
@@ -1,26 +1,32 @@
-About
+ABOUT
-Panelizer allows you to treat any node type as a panel node. You can provide default panels, per node type, and control both the available content and available layouts, also per node type.
+Panelizer allows you to treat any node type as a panel node. You can provide
+default panels, per node type, and control both the available content and
+available layouts, also per node type.
-Installing
+INSTALLING
-Install this through the normal Drupal method of putting the module in sites/all/modules and going to admin/build/modules to activate it.
+Install this through the normal Drupal method of putting the module in
+sites/all/modules and going to admin/build/modules to activate it.
It requires Panels and Page Manager.
-Initial configuration
+INITIAL CONFIGURATION
-Visit administer >> settings >> panelizer to enable the module for the node types you need.
+Visit administer >> settings >> panelizer to enable the module for the node
+types you need.
Ensure that the node template system page is enabled.
API
@todo
- drupal_alter('panelizer_default_types', $types, 'node');
+ drupal_alter('panelizer_default_types', $types, $context1);
Future functionality
- Allow panels for different build modes -- this is tricky
- - Fully implement the ability to choose from different defaults and restrict custom panel per node
+ - Fully implement the ability to choose from different defaults and restrict
+ custom panel per node
- Implement user panelizer
- - Implement panel subtabs. i.e, allow node/27/arbitrarylink to be a subtab of a node, using panelizer.
+ - Implement panel subtabs. i.e, allow node/27/arbitrarylink to be a subtab
+ of a node, using panelizer.