diff --git a/sites/all/modules/contrib/panels/panels/KNOWN_ISSUES.txt b/sites/all/modules/contrib/panels/panels/KNOWN_ISSUES.txt index 66963675..27f0e7a9 100644 --- a/sites/all/modules/contrib/panels/panels/KNOWN_ISSUES.txt +++ b/sites/all/modules/contrib/panels/panels/KNOWN_ISSUES.txt @@ -88,4 +88,4 @@ Known Issue http://drupal.org/node/207859 secure pages doesn't know about. When trying to make non-secure ajax calls from a secure page, the browser denies the call. Solution: - The solution is to simply add panels/* to your Secure Pages configuration. \ No newline at end of file + The solution is to simply add panels/* to your Secure Pages configuration. diff --git a/sites/all/modules/contrib/panels/panels/README.txt b/sites/all/modules/contrib/panels/panels/README.txt index 3c86762e..c6d7eeea 100644 --- a/sites/all/modules/contrib/panels/panels/README.txt +++ b/sites/all/modules/contrib/panels/panels/README.txt @@ -1,3 +1,3 @@ Welcome to Panels 3 -Documentation is available at https://www.drupal.org/node/496278 \ No newline at end of file +Documentation is available at https://www.drupal.org/node/496278 diff --git a/sites/all/modules/contrib/panels/panels/css/panels-dashboard.css b/sites/all/modules/contrib/panels/panels/css/panels-dashboard.css index a7efeae1..ca2fe9c9 100644 --- a/sites/all/modules/contrib/panels/panels/css/panels-dashboard.css +++ b/sites/all/modules/contrib/panels/panels/css/panels-dashboard.css @@ -1,4 +1,3 @@ - .dashboard-entry .dashboard-link { font-size: 120%; font-weight: bold; diff --git a/sites/all/modules/contrib/panels/panels/css/panels.css b/sites/all/modules/contrib/panels/panels/css/panels.css index 13c473cc..170652df 100644 --- a/sites/all/modules/contrib/panels/panels/css/panels.css +++ b/sites/all/modules/contrib/panels/panels/css/panels.css @@ -1,4 +1,3 @@ - div.panel-pane div.admin-links { font-size: xx-small; margin-right: 1em; diff --git a/sites/all/modules/contrib/panels/panels/css/panels_admin.css b/sites/all/modules/contrib/panels/panels/css/panels_admin.css index 78094e2c..ce61b036 100644 --- a/sites/all/modules/contrib/panels/panels/css/panels_admin.css +++ b/sites/all/modules/contrib/panels/panels/css/panels_admin.css @@ -1,4 +1,3 @@ - .layout-link { float: left; padding: 1em; @@ -141,12 +140,12 @@ table .argument-operation input { } tr.changed td { - background-color: #FFFFDD !important; + background-color: #ffffdd !important; } tr.changed td span.star { font-weight: bold; - color: #E09010; + color: #e09010; } td select { diff --git a/sites/all/modules/contrib/panels/panels/css/panels_dnd.css b/sites/all/modules/contrib/panels/panels/css/panels_dnd.css index 7252ad67..dc42d581 100644 --- a/sites/all/modules/contrib/panels/panels/css/panels_dnd.css +++ b/sites/all/modules/contrib/panels/panels/css/panels_dnd.css @@ -1,4 +1,3 @@ - #panels-dnd-main { margin: 0.5em 0; } @@ -42,7 +41,7 @@ div.panels-set-title-hide .panels-set-title { } /* Add Icon */ -#panels-dnd-main div.panel-region .pane-add-link { +#panels-dnd-main div.panel-region .pane-add-link { } #panels-dnd-main div.panel-region .pane-add-link img { display: none; @@ -127,24 +126,24 @@ div.panels-set-title-hide .panel-pane-is-title { } .panel-portlet .changed div.grab-title { - background-color: #FFFFDD !important; - border-bottom: 1px solid #3D9CD7 !important; + background-color: #ffffdd !important; + border-bottom: 1px solid #3d9cd7 !important; color: black !important; } .panel-portlet .changed.hidden-pane div.grab-title { - background-color: #B4B488 !important; - border-bottom: 1px solid #3D9CD7 !important; + background-color: #b4b488 !important; + border-bottom: 1px solid #3d9cd7 !important; } .panel-portlet .changed div.grab-title span.star { font-weight: bold; - color: #E09010; + color: #e09010; } .panel-portlet .grabber:hover { color: #fff; - background-color: #2F78A5; + background-color: #2f78a5; } .panel-portlet.hidden-pane .grab-title:hover { @@ -175,7 +174,8 @@ div.panels-set-title-hide .panel-pane-is-title { margin: 0; } -.panel-portlet .buttons input, .panel-portlet .buttons button { +.panel-portlet .buttons input, +.panel-portlet .buttons button { margin: 0; padding: 0; display: inline; @@ -186,7 +186,7 @@ div.panels-set-title-hide .panel-pane-is-title { } .panel-portlet .pane-title { - font-size:110%; + font-size: 110%; cursor: pointer; } @@ -315,7 +315,7 @@ a.close img { padding-left: 1em; padding-bottom: 1em; margin-bottom: 1em; - background-color: #EEEEEE; + background-color: #eeeeee; } .panels-section-columns { @@ -354,7 +354,7 @@ a.close img { .panels-section-column-categories .inside { padding: 0; - } +} .panels-section-column-categories .content-type-button { padding-left: 10px; @@ -431,7 +431,7 @@ a.close img { float: none; } -.panels-modal-content .modal-form .no-float label { +.panels-modal-content .modal-form .no-float label { width: auto; } @@ -502,7 +502,6 @@ html.js div.panels-display-links div.ctools-dropdown-container ul li a { /* @group CTools Dropdown */ #panels-dnd-main .ctools-dropdown a.ctools-dropdown-text-link, html.js div.panels-display-links a.ctools-dropdown-text-link { - background: url('../images/arrow-down-light.png') 0 3px no-repeat!important; padding-left: 12px; } @@ -522,7 +521,6 @@ html.js div.panels-display-links div.ctools-dropdown-container { html.js #panels-dnd-main div.ctools-dropdown div.ctools-dropdown-container ul li, html.js div.panels-display-links div.ctools-dropdown-container ul li { - text-decoration: none; padding: 0; margin: 0; @@ -565,7 +563,7 @@ html.js #panels-dnd-main div.ctools-dropdown div.ctools-dropdown-container ul li html.js div.panels-display-links div.ctools-dropdown-container ul li .panels-sub-menu ul li a, html.js #panels-dnd-main div.ctools-dropdown div.ctools-dropdown-container ul li .panels-sub-menu span.panels-text, html.js div.panels-display-links div.ctools-dropdown-container ul li .panels-sub-menu span.panels-text { - width:auto; + width: auto; padding: 0 20px; } @@ -682,4 +680,3 @@ div.ctools-modal-content { top: -2em; margin-bottom: -2em; } - diff --git a/sites/all/modules/contrib/panels/panels/css/panels_page.css b/sites/all/modules/contrib/panels/panels/css/panels_page.css index 1d731b97..cce85900 100644 --- a/sites/all/modules/contrib/panels/panels/css/panels_page.css +++ b/sites/all/modules/contrib/panels/panels/css/panels_page.css @@ -1,4 +1,3 @@ - div.panels-page-type-container { clear: left; } diff --git a/sites/all/modules/contrib/panels/panels/i18n_panels/i18n_panels.i18n.inc b/sites/all/modules/contrib/panels/panels/i18n_panels/i18n_panels.i18n.inc index 71fdafb7..d1478e30 100644 --- a/sites/all/modules/contrib/panels/panels/i18n_panels/i18n_panels.i18n.inc +++ b/sites/all/modules/contrib/panels/panels/i18n_panels/i18n_panels.i18n.inc @@ -1,7 +1,7 @@ uuid)) { // Fetch exported uuid and validate it. $uuid = str_replace('new-', '', $pane->pid); - if (!panels_uuid_is_valid($uuid)) { + if (!ctools_uuid_is_valid($uuid)) { drupal_set_message(t('The pane %pane has no uuid, please resave or re-export it.', array('%pane' => $pane->pid)), 'warning'); continue; } @@ -366,7 +367,7 @@ function _18n_panels_is_exported_panels_display($display) { * * @todo I bet there are better ways to solve this mess. * - * @param boolean $reset + * @param bool $reset * Reset the static cache. * * @return array diff --git a/sites/all/modules/contrib/panels/panels/images/icon-css.png b/sites/all/modules/contrib/panels/panels/images/icon-css.png new file mode 100644 index 00000000..9a8addf4 Binary files /dev/null and b/sites/all/modules/contrib/panels/panels/images/icon-css.png differ diff --git a/sites/all/modules/contrib/panels/panels/includes/callbacks.inc b/sites/all/modules/contrib/panels/panels/includes/callbacks.inc index 255a3cdd..57ef7cfb 100644 --- a/sites/all/modules/contrib/panels/panels/includes/callbacks.inc +++ b/sites/all/modules/contrib/panels/panels/includes/callbacks.inc @@ -1,6 +1,6 @@ t('Custom layouts can add more, site-specific layouts that you can use in your panels.'), ); - // Load all mini panels and their displays. + // Load all mini panels and their displays. ctools_include('export'); $items = ctools_export_crud_load_all('panels_layout'); $count = 0; @@ -97,7 +97,7 @@ function template_preprocess_panels_dashboard(&$vars) { $function($vars); } - // Add in any default links for modules that are not active + // Add in any default links for modules that are not active. panels_dashboard_final_blocks($vars); // If page manager module is enabled, add a very low eight block to @@ -138,7 +138,7 @@ function template_preprocess_panels_dashboard(&$vars) { 'class' => 'dashboard-create', ); - // Turn the links into a block + // Turn the links into a block. foreach ($vars['links'] as $link) { $vars['blocks']['links']['content'] .= theme('panels_dashboard_link', array('link' => $link)); } @@ -148,7 +148,7 @@ function template_preprocess_panels_dashboard(&$vars) { $vars['left'] = ''; $vars['right'] = ''; - // Render all the blocks + // Render all the blocks. foreach ($vars['blocks'] as $block) { $section = !empty($block['section']) ? $block['section'] : 'left'; $vars[$section] .= theme('panels_dashboard_block', array('block' => $block)); @@ -202,4 +202,3 @@ function panels_admin_panel_context_page() { ctools_include('common', 'panels'); return drupal_get_form('panels_common_settings', 'panels_page'); } - diff --git a/sites/all/modules/contrib/panels/panels/includes/common.inc b/sites/all/modules/contrib/panels/panels/includes/common.inc index 9e150e31..31d1bfec 100644 --- a/sites/all/modules/contrib/panels/panels/includes/common.inc +++ b/sites/all/modules/contrib/panels/panels/includes/common.inc @@ -39,12 +39,11 @@ * * @see panels_edit_layout() * @see _panels_edit_layout() - * */ class panels_allowed_layouts { /** - * Specifies whether newly-added layouts (as in, new .inc files) should be automatically + * Specifies whether newly-added layouts (as in, new .inc files) should be automatically * allowed (TRUE) or disallowed (FALSE) for $this. Defaults to TRUE, which is more * permissive but less of an administrative hassle if/when you add new layouts. Note * that this parameter will be derived from $allowed_layouts if a value is passed in. @@ -52,19 +51,20 @@ class panels_allowed_layouts { var $allow_new = TRUE; /** - * Optional member. If provided, the Panels API will generate a drupal variable using + * Optional member. If provided, the Panels API will generate a drupal variable using * variable_set($module_name . 'allowed_layouts', serialize($this)), thereby handling the * storage of this object entirely within the Panels API. This object will be * called and rebuilt by panels_edit_layout() if the same $module_name string is passed in * for the $allowed_types parameter. \n * This is primarily intended for convenience - client modules doing heavy-duty implementations * of the Panels API will probably want to create their own storage method. + * * @see panels_edit_layout() */ var $module_name = NULL; /** - * An associative array of all available layouts, keyed by layout name (as defined + * An associative array of all available layouts, keyed by layout name (as defined * in the corresponding layout plugin definition), with value = 1 if the layout is * allowed, and value = 0 if the layout is not allowed. * Calling array_filter(panels_allowed_layouts::$allowed_layout_settings) will return an associative array @@ -82,15 +82,14 @@ class panels_allowed_layouts { /** * Constructor function; loads the $allowed_layout_settings array with initial values according - * to $start_allowed + * to $start_allowed. * * @param bool $start_allowed - * $start_allowed determines whether all available layouts will be marked - * as allowed or not allowed on the initial call to panels_allowed_layouts::set_allowed() - * + * $start_allowed determines whether all available layouts will be marked + * as allowed or not allowed on the initial call to panels_allowed_layouts::set_allowed() */ function __construct($start_allowed = TRUE) { - // TODO would be nice if there was a way to just fetch the names easily + // TODO would be nice if there was a way to just fetch the names easily. foreach ($this->list_layouts() as $layout_name) { $this->allowed_layout_settings[$layout_name] = $start_allowed ? 1 : 0; } @@ -121,6 +120,7 @@ class panels_allowed_layouts { * drupal_goto(''); * } * } + * * @endcode \n * * If $allowed_layouts->form_state == 'failed-validate' || 'render', then you'll need to return @@ -135,8 +135,8 @@ class panels_allowed_layouts { * you to control where the user ends up next. * * @param string $title - * Used to set the title of the allowed layouts form. If no value is given, defaults to - * 'Panels: Allowed Layouts'. + * Used to set the title of the allowed layouts form. If no value is given, defaults to + * 'Panels: Allowed Layouts'. * * @return mixed $result * - On the first passthrough when the form is being rendered, $result is the form's structured @@ -147,11 +147,11 @@ class panels_allowed_layouts { function set_allowed($title = 'Panels: Allowed Layouts') { $this->sync_with_available(); $form_id = 'panels_common_set_allowed_layouts'; - // TODO switch to drupal_build_form(); need to pass by ref + // TODO switch to drupal_build_form(); need to pass by ref. $form = drupal_retrieve_form($form_id, $this, $title); if ($result = drupal_process_form($form_id, $form)) { - // successful submit + // Successful submit. $this->form_state = 'submit'; return $result; } @@ -192,11 +192,10 @@ class panels_allowed_layouts { * If you don't serialize the second parameter of variable_get() and the variable name you provide * can't be found, an E_STRICT warning will be generated for trying to unserialize an entity * that has not been serialized. - * */ function save() { if (!is_null($this->module_name)) { - variable_set($this->module_name . '_allowed_layouts', serialize($this)); + variable_set($this->module_name . "_allowed_layouts", serialize($this)); } } @@ -217,6 +216,7 @@ class panels_allowed_layouts { } return $layouts; } + } /** @@ -272,11 +272,7 @@ function panels_common_settings($form, &$form_state, $module_name = 'panels_comm // each type its own checkboxes set unless it's 'single' in which // case it can go into our fake other set. $available_content_types = ctools_content_get_all_types(); - $allowed_content_types = db_select('panels_allowed_types', 'pat') - ->fields('pat', array('type', 'allowed')) - ->condition('module', $module_name) - ->execute() - ->fetchAllKeyed(); + $allowed_content_types = variable_get($module_name . '_allowed_types', array()); foreach ($available_content_types as $id => $types) { foreach ($types as $type => $info) { @@ -296,7 +292,7 @@ function panels_common_settings($form, &$form_state, $module_name = 'panels_comm '#tree' => TRUE, ); - // cheat a bit + // Cheat a bit. $content_types['other'] = array('title' => t('Other'), 'weight' => 10); foreach ($content_types as $id => $info) { if (isset($allowed[$id])) { @@ -342,14 +338,14 @@ function panels_common_settings($form, &$form_state, $module_name = 'panels_comm } /** - * Submit hook for panels_common_settings + * Submit hook for panels_common_settings. */ function panels_common_settings_validate($form, &$form_state) { panels_common_allowed_layouts_form_validate($form, $form_state); } /** - * Submit hook for panels_common_settings + * Submit hook for panels_common_settings. */ function panels_common_settings_submit($form, &$form_state) { panels_common_allowed_layouts_form_submit($form, $form_state); @@ -358,21 +354,21 @@ function panels_common_settings_submit($form, &$form_state) { if (!$form_state['skip']) { // Merge the broken apart array neatly back together. $allowed_content_types = array(); - $content_types = $form_state['values']['allowed']; - foreach ($content_types as $content_type) { - $allowed_content_types = array_merge($allowed_content_types, $form_state['values']['content_types'][$content_type]['options']); - foreach ($allowed_content_types as $type => $allowed) { - $allowed = empty($allowed) ? 0 : 1; - db_merge('panels_allowed_types') - ->key(array('module' => $module_name, 'type' => $type)) - ->fields(array( - 'module' => $module_name, - 'type' => $type, - 'allowed' => $allowed, - )) - ->execute(); + foreach ($form_state['values']['allowed'] as $allowed) { + $values = $form_state['values']['content_types'][$allowed]['options']; + // If new content of the type is not added, storing a lisy of disabled + // content is not needed. + if (!$form_state['values']['panels_common_default'][$allowed]) { + $values = array_filter($values); } + $allowed_content_types = array_merge($allowed_content_types, $values); } + // Values from checkboxes are the same string as they key, but we only need + // to store the boolean value. + foreach ($allowed_content_types as &$value) { + $value = (bool) $value; + } + variable_set($module_name . '_allowed_types', $allowed_content_types); } drupal_set_message(t('Your changes have been saved.')); } @@ -381,14 +377,9 @@ function panels_common_settings_submit($form, &$form_state) { * Based upon the settings, get the allowed types for this node. */ function panels_common_get_allowed_types($module, $contexts = array(), $has_content = FALSE, $default_defaults = array(), $default_allowed_types = array()) { - // Get a list of all types that are available + // Get a list of all types that are available. $default_types = variable_get($module . '_default', $default_defaults); - $allowed_types = db_select('panels_allowed_types', 'pat') - ->fields('pat', array('type', 'allowed')) - ->condition('module', $module) - ->execute() - ->fetchAllKeyed(); - $allowed_types = !empty($allowed_types) ? $allowed_types : $default_allowed_types; + $allowed_types = variable_get($module . '_allowed_types', $default_allowed_types); // By default, if they haven't gone and done the initial setup here, // let all 'other' types (which will be all types) be available. @@ -420,8 +411,8 @@ function panels_common_get_allowed_types($module, $contexts = array(), $has_cont * @ingroup forms * * @param array $allowed_layouts - * The set of allowed layouts that should be used as the default values - * for this form. If none is provided, then by default no layouts will be restricted. + * The set of allowed layouts that should be used as the default values + * for this form. If none is provided, then by default no layouts will be restricted. */ function panels_common_allowed_layouts_form(&$form, &$form_state, $module_name) { // Fetch our allowed layouts from variables. @@ -434,6 +425,7 @@ function panels_common_allowed_layouts_form(&$form, &$form_state, $module_name) $form_state['allowed_layouts'] = &$allowed_layouts; + ctools_add_js('panels-base', 'panels'); ctools_add_js('layout', 'panels'); $form['layout_selection'] = array( @@ -473,19 +465,19 @@ function panels_common_allowed_layouts_form_submit($form, &$form_state) { * Get the allowed layout object for the given module. */ function panels_common_get_allowed_layout_object($module_name) { - $allowed_layouts = unserialize(variable_get($module_name . '_allowed_layouts', serialize(''))); + $allowed_layouts = unserialize(variable_get($module_name . "_allowed_layouts", serialize(''))); - // if no parameter was provided, or the variable_get failed + // If no parameter was provided, or the variable_get failed. if (!$allowed_layouts) { - // still no dice. simply creates a dummy version where all layouts + // Still no dice. simply creates a dummy version where all layouts // are allowed. $allowed_layouts = new panels_allowed_layouts(); $allowed_layouts->allow_new = TRUE; $allowed_layouts->module_name = $module_name; } - // sanitize allowed layout listing; this is redundant if the - // $allowed_layouts param was null, but the data is cached anyway + // Sanitize allowed layout listing; this is redundant if the + // $allowed_layouts param was null, but the data is cached anyway. $allowed_layouts->sync_with_available(); return $allowed_layouts; @@ -500,7 +492,7 @@ function panels_common_get_allowed_layouts($module_name) { if (empty($module_name)) { return $available_layouts; } - else if (is_object($module_name)) { + elseif (is_object($module_name)) { $allowed_layouts = $module_name; } else { @@ -515,7 +507,7 @@ function panels_common_get_allowed_layouts($module_name) { } } - // Sort + // Sort. $layouts = array(); asort($order); @@ -603,7 +595,6 @@ function panels_common_print_layout_links($layouts, $base_path, $link_options = // We're doing these dependencies completely manualy, which is unusual, but // the process code only supports doing them in a form. // @todo modify dependent.inc to make this easier. - $dependencies = array(); foreach ($options as $category => $links) { $dependencies['panels-layout-category-' . $category] = array( diff --git a/sites/all/modules/contrib/panels/panels/includes/display-edit.inc b/sites/all/modules/contrib/panels/panels/includes/display-edit.inc index dbc4786c..d48c789f 100644 --- a/sites/all/modules/contrib/panels/panels/includes/display-edit.inc +++ b/sites/all/modules/contrib/panels/panels/includes/display-edit.inc @@ -1,6 +1,6 @@ panels[$region_id] = array(); if ($panes) { $pids = explode(',', $panes); - // need to filter the array, b/c passing it in a hidden field can generate trash + // Need to filter the array, b/c passing it in a hidden field can generate trash. foreach (array_filter($pids) as $pid) { if ($old_content[$pid]) { $display->panels[$region_id][] = $pid; @@ -221,7 +222,7 @@ function panels_edit_display_settings_form($form, &$form_state) { ctools_include('dependent'); if ($form_state['display_title']) { - $form['display_title'] = array ( + $form['display_title'] = array( '#tree' => TRUE, ); @@ -252,16 +253,15 @@ function panels_edit_display_settings_form($form, &$form_state) { // We have to create a manual fieldset because fieldsets do not support IDs. // Use 'hidden' instead of 'markup' so that the process will run. // Add js for collapsible fieldsets manually -// drupal_add_js('misc/form.js'); -// drupal_add_js('misc/collapse.js'); -// $form['display_title']['contexts_prefix'] = array( -// '#type' => 'hidden', -// '#id' => 'edit-display-substitutions', -// '#prefix' => '
', + // );. } } - // TODO doc the ability to do this as part of the API + // TODO doc the ability to do this as part of the API. if (!empty($layout['settings form']) && function_exists($layout['settings form'])) { $form['layout_settings'] = $layout['settings form']($display, $layout, $display->layout_settings); } diff --git a/sites/all/modules/contrib/panels/panels/includes/display-layout.inc b/sites/all/modules/contrib/panels/panels/includes/display-layout.inc index a21e6630..aac3fe66 100644 --- a/sites/all/modules/contrib/panels/panels/includes/display-layout.inc +++ b/sites/all/modules/contrib/panels/panels/includes/display-layout.inc @@ -2,7 +2,6 @@ /** * @file - * * Handle the forms for changing a display's layout. */ @@ -33,7 +32,7 @@ function _panels_edit_layout($display, $finish, $destination, $allowed_layouts) if (empty($_POST) || empty($_POST['form_id']) || $_POST['form_id'] != 'panels_change_layout') { $output = drupal_build_form('panels_choose_layout', $form_state); if (!empty($form_state['executed'])) { - // upon submission go to next form. + // Upon submission go to next form. $change_form_state['layout'] = $_SESSION['layout'][$display->did] = $form_state['layout']; $change_form = TRUE; } @@ -147,7 +146,6 @@ function panels_choose_layout($form, &$form_state) { $js['CTools']['dependent'] = $dependencies; drupal_add_js($js, 'setting'); - if (empty($form_state['no buttons'])) { $form['submit'] = array( '#type' => 'submit', @@ -293,7 +291,7 @@ function panels_change_layout_submit($form, &$form_state) { foreach ($form_state['values']['panel']['pane'] as $region_id => $panes) { if ($panes) { $pids = explode(',', $panes); - // need to filter the array, b/c passing it in a hidden field can generate trash + // Need to filter the array, b/c passing it in a hidden field can generate trash. foreach (array_filter($pids) as $pid) { $switch[$pid] = $region_id; } diff --git a/sites/all/modules/contrib/panels/panels/includes/legacy.inc b/sites/all/modules/contrib/panels/panels/includes/legacy.inc index c65f781d..224d05fb 100644 --- a/sites/all/modules/contrib/panels/panels/includes/legacy.inc +++ b/sites/all/modules/contrib/panels/panels/includes/legacy.inc @@ -1,22 +1,32 @@ legacy)) { $this->determineStatus(); @@ -29,7 +39,7 @@ class PanelsLegacyState { */ function determineStatus() { $this->legacy = array(); - foreach(get_class_methods($this) as $method) { + foreach (get_class_methods($this) as $method) { if (strtolower(substr($method, 0, 5)) == 'check') { $this->legacy[$method] = $this->$method(); } @@ -37,5 +47,4 @@ class PanelsLegacyState { $this->legacy = array_filter($this->legacy); } - // At this time there are no legacy checks. } diff --git a/sites/all/modules/contrib/panels/panels/includes/page-wizard.inc b/sites/all/modules/contrib/panels/panels/includes/page-wizard.inc index 732c13aa..516f78f5 100644 --- a/sites/all/modules/contrib/panels/panels/includes/page-wizard.inc +++ b/sites/all/modules/contrib/panels/panels/includes/page-wizard.inc @@ -35,7 +35,7 @@ function panels_page_wizard_add_layout(&$form, &$form_state) { '#value' => '', ); -// $form_state['cache'] = FALSE; + // $form_state['cache'] = FALSE;. } /** @@ -52,7 +52,6 @@ function panels_page_wizard_add_content(&$form, &$form_state) { // Panels provides this caching mechanism to make it easy to use the // wizard to cache the display. - $cache = panels_edit_cache_get('panels_page_wizard:' . $form_state['plugin']['name']); $form_state['renderer'] = panels_get_renderer_handler('editor', $cache->display); @@ -68,14 +67,14 @@ function panels_page_wizard_add_content(&$form, &$form_state) { } /** - * Add content form submit handler + * Add content form submit handler. * * This is not a proper submit handler, it is meant to be called by a form's * submit handler to handle submission. */ function panels_page_wizard_add_content_submit(&$form, &$form_state) { // Call the normal panels edit form submit to make sure values are stored - // on the display + // on the display. panels_edit_display_form_submit($form, $form_state); $cache = &$form_state['wizard cache']; @@ -83,4 +82,3 @@ function panels_page_wizard_add_content_submit(&$form, &$form_state) { $cache->display = &$form_state['display']; unset($cache->display_cache); } - diff --git a/sites/all/modules/contrib/panels/panels/includes/panels.pipelines.inc b/sites/all/modules/contrib/panels/panels/includes/panels.pipelines.inc index 3d95ac0c..5a3f1cb3 100644 --- a/sites/all/modules/contrib/panels/panels/includes/panels.pipelines.inc +++ b/sites/all/modules/contrib/panels/panels/includes/panels.pipelines.inc @@ -11,7 +11,7 @@ function panels_default_panels_renderer_pipeline() { $pipelines = array(); - $pipeline = new stdClass; + $pipeline = new stdClass(); $pipeline->disabled = FALSE; /* Edit this to true to make a default pipeline disabled initially */ $pipeline->api_version = 1; $pipeline->name = 'standard'; diff --git a/sites/all/modules/contrib/panels/panels/includes/plugins.inc b/sites/all/modules/contrib/panels/panels/includes/plugins.inc index be5cd257..05088830 100644 --- a/sites/all/modules/contrib/panels/panels/includes/plugins.inc +++ b/sites/all/modules/contrib/panels/panels/includes/plugins.inc @@ -2,7 +2,6 @@ /** * @file - * * Contains helper code for plugins and contexts. */ @@ -41,7 +40,7 @@ function panels_get_regions($layout, $display) { * The cached content, or FALSE to indicate no cached content exists. */ function panels_get_cached_content($display, $args, $context, $pane = NULL) { - // Never use cache on a POST + // Never use cache on a POST. if (!empty($_POST)) { return FALSE; } @@ -59,7 +58,7 @@ function panels_get_cached_content($display, $args, $context, $pane = NULL) { return FALSE; } - // restore it. + // Restore it. $cache->restore(); return $cache; } @@ -68,7 +67,7 @@ function panels_get_cached_content($display, $args, $context, $pane = NULL) { * Store cached content for a given display and possibly pane. */ function panels_set_cached_content($cache, $display, $args, $context, $pane = NULL) { - // Never use cache on a POST + // Never use cache on a POST. if (!empty($_POST)) { return FALSE; } @@ -82,7 +81,7 @@ function panels_set_cached_content($cache, $display, $args, $context, $pane = NU $conf = $pane ? $pane->cache['settings'] : $display->cache['settings']; - // snapshot it. + // Snapshot it. $cache->cache(); return $function($conf, $cache, $display, $args, $context, $pane); } @@ -154,7 +153,7 @@ class panels_cache_object { $this->ready = TRUE; - // Simple replacement for head + // Simple replacement for head. $this->head = str_replace($this->head, '', drupal_add_html_head()); // Slightly less simple for CSS: @@ -248,6 +247,7 @@ class panels_cache_object { } } } + } /** @@ -412,7 +412,7 @@ function panels_get_renderer_handler($plugin, &$display) { * Choose a renderer for a display based on a render pipeline setting. */ function panels_get_renderer($pipeline_name, &$display) { - // Load the pipeline + // Load the pipeline. ctools_include('export'); $pipeline = ctools_export_crud_load('panels_renderer_pipeline', $pipeline_name); @@ -443,7 +443,7 @@ function panels_get_renderer($pipeline_name, &$display) { return $renderer; } - // Fall through. If no renderer is selected, use the standard renderer + // Fall through. If no renderer is selected, use the standard renderer. return panels_get_renderer_handler('standard', $display); } @@ -454,9 +454,9 @@ function panels_get_renderer($pipeline_name, &$display) { */ function _panels_renderer_pipeline_sort($a, $b) { if ($a->weight == $b->weight) { - if ($a->admin_title == $b->admin_title) { - return 0; - } + if ($a->admin_title == $b->admin_title) { + return 0; + } return ($a->admin_title < $b->admin_title) ? -1 : 1; } return ($a->weight < $b->weight) ? -1 : 1; diff --git a/sites/all/modules/contrib/panels/panels/panels.api.php b/sites/all/modules/contrib/panels/panels/panels.api.php index 1aa1c6ad..3d148bae 100644 --- a/sites/all/modules/contrib/panels/panels/panels.api.php +++ b/sites/all/modules/contrib/panels/panels/panels.api.php @@ -11,7 +11,7 @@ * @param string $argument * The second half of the cache key. Full key module:TASK_NAME:HANDLER_NAME * passed part: TASK_NAME:HANDLER_NAME - * @param stdClass $cache + * @param object $cache * The display to cache. */ function hook_panels_cache_set($argument, $cache) { @@ -56,7 +56,7 @@ function hook_panels_cache_get($argument) { * @param string $argument * The second half of the cache key. Full key module:TASK_NAME:HANDLER_NAME * passed part: TASK_NAME:HANDLER_NAME - * @param stdClass $cache + * @param object $cache * The display to cache. * * @return stdClass @@ -78,7 +78,7 @@ function hook_panels_cache_save($argument, $cache) { * @param string $argument * The second half of the cache key. Full key module:TASK_NAME:HANDLER_NAME * passed part: TASK_NAME:HANDLER_NAME - * @param stdClass $cache + * @param object $cache * The cached display. */ function hook_panels_cache_clear($argument, $cache) { @@ -105,9 +105,9 @@ function hook_panels_dashboard_blocks(&$vars) { * * This happens after the keyword substitution. * - * @param stdClass $content + * @param object $content * The content block to render. - * @param stdClass $pane + * @param object $pane * The pane object. * @param array $args * The display arguments. @@ -125,7 +125,7 @@ function hook_panels_pane_content_alter($content, $pane, $args, $contexts) { * @param string $argument * The second half of the cache key. Full key module:TASK_NAME:HANDLER_NAME * passed part: TASK_NAME:HANDLER_NAME - * @param stdClass $cache + * @param object $cache * The cached display. */ function hook_panels_edit_cache_break_lock($argument, $cache) { @@ -140,7 +140,7 @@ function hook_panels_edit_cache_break_lock($argument, $cache) { * * @param panels_display $panels_display * The panels display that will be rendered. - * @param stdClass $renderer + * @param object $renderer * The renderer object that will be used to render. * * @return string @@ -158,7 +158,7 @@ function hook_panels_pre_render($panels_display, $renderer) { * * @param panels_display $panels_display * The rendered panels display. - * @param stdClass $renderer + * @param object $renderer * The used renderer object. * * @return string @@ -171,7 +171,7 @@ function hook_panels_post_render($panels_display, $renderer) { /** * Fired before a new pane is inserted in the storage. * - * @param stdClass $pane + * @param object $pane * Pane that will be rendered. */ function hook_panels_pane_insert($pane) { @@ -188,7 +188,7 @@ function hook_panels_pane_insert($pane) { /** * Fired before a changed pane is updated in the storage. * - * @param stdClass $pane + * @param object $pane * Pane that will be rendered. */ function hook_panels_pane_update($pane) { @@ -208,7 +208,7 @@ function hook_panels_pane_update($pane) { * Last chance to modify the pane before the keyword substitution runs and the * pane is rendered. * - * @param stdClass $pane + * @param object $pane * Pane that will be rendered. */ function hook_panels_pane_prerender($pane) { @@ -250,7 +250,7 @@ function hook_panels_display_save($display) { /** * Fired before a display is deleted. * - * @param integer $did + * @param int $did * Id of the display to delete. */ function hook_panels_delete_display($did) { diff --git a/sites/all/modules/contrib/panels/panels/panels.info b/sites/all/modules/contrib/panels/panels/panels.info index 6a6f29fe..6ad152c5 100644 --- a/sites/all/modules/contrib/panels/panels/panels.info +++ b/sites/all/modules/contrib/panels/panels/panels.info @@ -18,9 +18,9 @@ files[] = tests/PanelsNodeViewWebTestCase.test files[] = tests/PanelsTermViewWebTestCase.test files[] = tests/PanelsUserViewWebTestCase.test -; Information added by Drupal.org packaging script on 2016-10-16 -version = "7.x-3.8" +; Information added by Drupal.org packaging script on 2017-02-06 +version = "7.x-3.9" core = "7.x" project = "panels" -datestamp = "1476582295" +datestamp = "1486394388" diff --git a/sites/all/modules/contrib/panels/panels/panels.install b/sites/all/modules/contrib/panels/panels/panels.install index 11cf7a47..16b65afe 100644 --- a/sites/all/modules/contrib/panels/panels/panels.install +++ b/sites/all/modules/contrib/panels/panels/panels.install @@ -1,5 +1,9 @@ array('pid'), 'indexes' => array( - 'did_idx' => array('did') + 'did_idx' => array('did'), ), ); @@ -445,9 +449,7 @@ function panels_update_7300() { */ function panels_update_7301() { // Load the schema. - // Due to a previous failure, the field may already exist: - $schema = panels_schema_4(); $table = 'panels_pane'; $field = 'locks'; @@ -627,7 +629,7 @@ function panels_update_7306() { } if (!empty($page_manager_panels)) { - // Check panels displays that only have empty storage types + // Check panels displays that only have empty storage types. $result = db_query("SELECT pd.did FROM {panels_display} pd WHERE pd.did IN (:dids) AND storage_type = ''", array(':dids' => array_keys($page_manager_panels))); foreach ($result as $row) { db_update('panels_display') @@ -652,28 +654,15 @@ function panels_update_7307() { db_create_table($table_name, $schema[$table_name]); } - // Read existing allowed settings and store them in a new table. - $variables = db_select('variable', 'v') - ->fields('v', array('name')) - ->condition('name', '%' . db_like('_allowed_types'), 'LIKE') - ->execute() - ->fetchCol(); - foreach ($variables as $name) { - $module = str_replace('_allowed_types', '', $name); - $variable = variable_get($name); - foreach ($variable as $type => $allowed) { - $allowed = empty($allowed) ? 0 : 1; - db_merge('panels_allowed_types') - ->key(array('module' => $module, 'type' => $type)) - ->fields(array( - 'module' => $module, - 'type' => $type, - 'allowed' => $allowed, - )) - ->execute(); - } - variable_del($name); - } + /* + The version of this update hook in release 3.8 included code that + converted storage of allowed_types configuration from variables to the new + table, and also deleted existing allowed_types configuration variables. + See https://www.drupal.org/node/2479879. + + In order to prevent data loss on sites that had not yet updated to 3.8, the + conversion and variable-deletion code has been removed from this update hook. + */ } /** diff --git a/sites/all/modules/contrib/panels/panels/panels.module b/sites/all/modules/contrib/panels/panels/panels.module index fc25c09b..6374d17b 100644 --- a/sites/all/modules/contrib/panels/panels/panels.module +++ b/sites/all/modules/contrib/panels/panels/panels.module @@ -1,8 +1,7 @@ array('title' => NULL, 'id' => NULL, 'image' => NULL, 'link' => NULL, 'class' => NULL), + 'variables' => array( + 'title' => NULL, + 'id' => NULL, + 'image' => NULL, + 'link' => NULL, + 'class' => NULL, + ), ); $theme['panels_layout_icon'] = array( - 'variables' => array('id' => NULL, 'image' => NULL, 'title' => NULL), + 'variables' => array( + 'id' => NULL, + 'image' => NULL, + 'title' => NULL, + ), ); $theme['panels_pane'] = array( - 'variables' => array('content' => array(), 'pane' => array(), 'display' => array()), + 'variables' => array( + 'content' => array(), + 'pane' => array(), + 'display' => array(), + ), 'path' => drupal_get_path('module', 'panels') . '/templates', 'template' => 'panels-pane', ); @@ -92,25 +106,29 @@ function panels_theme() { ); $theme['panels_add_content_modal'] = array( - 'variables' => array('renderer' => NULL, 'categories' => array(), 'region' => NULL, 'category' => NULL, 'column_count' => 2), + 'variables' => array( + 'renderer' => NULL, + 'categories' => array(), + 'region' => NULL, + 'category' => NULL, + 'column_count' => 2, + ), 'path' => drupal_get_path('module', 'panels') . '/templates', 'file' => '../includes/add-content.inc', 'template' => 'panels-add-content-modal', ); $theme['panels_add_content_link'] = array( - 'variables' => array('renderer' => NULL, 'region' => NULL, 'content_type' => NULL), + 'variables' => array( + 'renderer' => NULL, + 'region' => NULL, + 'content_type' => NULL, + ), 'path' => drupal_get_path('module', 'panels') . '/templates', 'file' => '../includes/add-content.inc', 'template' => 'panels-add-content-link', ); - // We don't need layout and style themes in maintenance mode. - // Disabling this: See http://drupal.org/node/979912 for information. -// if (defined('MAINTENANCE_MODE')) { -// return $theme; -// } - // Register layout and style themes on behalf of all of these items. ctools_include('plugins', 'panels'); @@ -121,15 +139,23 @@ function panels_theme() { foreach (array('theme', 'admin theme') as $callback) { if (!empty($data[$callback])) { $theme[$data[$callback]] = array( - 'variables' => array('css_id' => NULL, 'content' => NULL, 'settings' => NULL, 'display' => NULL, 'layout' => NULL, 'renderer' => NULL), + 'variables' => array( + 'css_id' => NULL, + 'content' => NULL, + 'settings' => NULL, + 'display' => NULL, + 'layout' => NULL, + 'renderer' => NULL, + ), 'path' => $data['path'], 'file' => $data['file'], ); - // if no theme function exists, assume template. + // If no theme function exists, assume template. if (!function_exists("theme_$data[theme]")) { $theme[$data[$callback]]['template'] = str_replace('_', '-', $data[$callback]); - $theme[$data[$callback]]['file'] = $data['file']; // for preprocess. + // For preprocess. + $theme[$data[$callback]]['file'] = $data['file']; } } } @@ -139,14 +165,27 @@ function panels_theme() { foreach ($styles as $name => $data) { if (!empty($data['render pane'])) { $theme[$data['render pane']] = array( - 'variables' => array('content' => NULL, 'pane' => NULL, 'display' => NULL, 'style' => NULL, 'settings' => NULL), + 'variables' => array( + 'content' => NULL, + 'pane' => NULL, + 'display' => NULL, + 'style' => NULL, + 'settings' => NULL, + ), 'path' => $data['path'], 'file' => $data['file'], ); } if (!empty($data['render region'])) { $theme[$data['render region']] = array( - 'variables' => array('display' => NULL, 'owner_id' => NULL, 'panes' => NULL, 'settings' => NULL, 'region_id' => NULL, 'style' => NULL), + 'variables' => array( + 'display' => NULL, + 'owner_id' => NULL, + 'panes' => NULL, + 'settings' => NULL, + 'region_id' => NULL, + 'style' => NULL, + ), 'path' => $data['path'], 'file' => $data['file'], ); @@ -156,17 +195,16 @@ function panels_theme() { if (is_array($data['hook theme'])) { $theme += $data['hook theme']; } - else if (function_exists($data['hook theme'])) { + elseif (function_exists($data['hook theme'])) { $data['hook theme']($theme, $data); } } } - return $theme; } /** - * Implementation of hook_menu + * Implements hook_menu(). */ function panels_menu() { // Safety: go away if CTools is not at an appropriate version. @@ -234,13 +272,11 @@ function panels_menu() { if (is_array($data['hook menu'])) { $items += $data['hook menu']; } - else if (function_exists($data['hook menu'])) { + elseif (function_exists($data['hook menu'])) { $data['hook menu']($items, $data); } } } - - return $items; } @@ -261,7 +297,7 @@ function panels_edit_cache_load($cache_key) { } /** - * Implementation of hook_init() + * Implements hook_init(). */ function panels_init() { // Safety: go away if CTools is not at an appropriate version. @@ -276,7 +312,7 @@ function panels_init() { } /** - * Implementation of hook_permission(). + * Implements hook_permission(). * * @todo Almost all of these need to be moved into pipelines. */ @@ -286,11 +322,13 @@ function panels_permission() { 'title' => t("Use Panels Dashboard"), 'description' => t('Allows a user to access the Panels Dashboard.', array('@url' => url('admin/structure/panels'))), ), - 'view pane admin links' => array( // @todo + // @todo + 'view pane admin links' => array( 'title' => t("View administrative links on Panel panes"), - 'description' => t(""), + 'description' => "", ), - 'administer pane access' => array( // @todo should we really have a global perm for this, or should it be moved into a pipeline question? + // @todo should we really have a global perm for this, or should it be moved into a pipeline question? + 'administer pane access' => array( 'title' => t("Configure access settings on Panel panes"), 'description' => t("Access rules (often also called visibility rules) can be configured on a per-pane basis. This permission allows users to configure those settings."), ), @@ -309,7 +347,7 @@ function panels_permission() { ), 'administer advanced pane settings' => array( 'title' => t("Configure advanced settings on Panel panes"), - 'description' => t(""), + 'description' => "", ), 'administer panels layouts' => array( 'title' => t("Administer Panels layouts"), @@ -355,16 +393,17 @@ function panels_flush_caches() { } } -// --------------------------------------------------------------------------- -// CTools hook implementations -// -// These aren't core Drupal hooks but they are just as important. +/** + * CTools hook implementations. + * + * These aren't core Drupal hooks but they are just as important. + */ /** - * Implementation of hook_ctools_plugin_directory() to let the system know - * we implement task and task_handler plugins. + * Implements hook_ctools_plugin_directory(). */ function panels_ctools_plugin_directory($module, $plugin) { + // To let the system know we implement task and task_handler plugins. // Safety: go away if CTools is not at an appropriate version. if (!module_invoke('ctools', 'api_version', PANELS_REQUIRED_CTOOLS_API)) { return; @@ -373,8 +412,8 @@ function panels_ctools_plugin_directory($module, $plugin) { // We don't support the 'ctools' 'cache' plugin and pretending to causes // errors when they're in use. if ($module == 'ctools' && $plugin == 'cache') { + // If we did we'd make a plugin/ctools_cache or something. return; - // if we did we'd make a plugin/ctools_cache or something. } if ($module == 'page_manager' || $module == 'panels' || $module == 'ctools' || $module == 'stylizer') { @@ -383,7 +422,6 @@ function panels_ctools_plugin_directory($module, $plugin) { if ($module == 'ctools' && $plugin == 'cache') { return; } - return 'plugins/' . $plugin; } } @@ -397,7 +435,8 @@ function panels_ctools_plugin_directory($module, $plugin) { function panels_ctools_plugin_type() { return array( 'layouts' => array( - 'load themes' => TRUE, // Can define layouts in themes + // We can define layouts in themes. + 'load themes' => TRUE, 'process' => 'panels_layout_process', 'child plugins' => TRUE, ), @@ -425,18 +464,11 @@ function panels_layout_process(&$plugin) { } /** - * Implementation of hook_ctools_plugin_api(). - * - * Inform CTools about version information for various plugins implemented by - * Panels. - * - * @param string $owner - * The system name of the module owning the API about which information is - * being requested. - * @param string $api - * The name of the API about which information is being requested. + * Implements hook_ctools_plugin_api(). */ function panels_ctools_plugin_api($owner, $api) { + // Inform CTools about version information for various plugins implemented by + // panels. if ($owner == 'panels' && $api == 'styles') { // As of 6.x-3.6, Panels has a slightly new system for style plugins. return array('version' => 2.0); @@ -451,7 +483,7 @@ function panels_ctools_plugin_api($owner, $api) { } /** - * Implementation of hook_views_api(). + * Implements hook_views_api(). */ function panels_views_api() { return array( @@ -468,12 +500,12 @@ function panels_views_api() { * parameters to a style plugin in a hybrid environment of both new and old * plugins. * - * @see _ctools_process_data() - * * @param array $plugin * The style plugin that is being processed. * @param array $info * The style plugin type info array. + * + * @see _ctools_process_data() */ function panels_plugin_styles_process(&$plugin, $info) { $plugin += array( @@ -492,22 +524,49 @@ function panels_ctools_style_base_types() { 'region' => array( 'title' => t('Panel region'), 'preview' => 'panels_stylizer_region_preview', - 'theme variables' => array('settings' => NULL, 'class' => NULL, 'content' => NULL), + 'theme variables' => array( + 'settings' => NULL, + 'class' => NULL, + 'content' => NULL, + ), ), 'pane' => array( 'title' => t('Panel pane'), 'preview' => 'panels_stylizer_pane_preview', - 'theme variables' => array('settings' => NULL, 'content' => NULL, 'pane' => NULL, 'display' => NULL), + 'theme variables' => array( + 'settings' => NULL, + 'content' => NULL, + 'pane' => NULL, + 'display' => NULL, + ), ), ); } +/** + * Generates Lorem Ipsum. + * + * @return string + * Lorem ipsum string. + */ function panels_stylizer_lipsum() { - return " -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus at velit dolor. Donec egestas tellus sit amet urna rhoncus adipiscing. Proin nec porttitor sem. Maecenas aliquam, purus nec tempus dignissim, nulla arcu aliquam diam, non tincidunt massa ante vel dolor. Aliquam sapien sapien, tincidunt id tristique at, pretium sagittis libero.
- -Nulla facilisi. Curabitur lacinia, tellus sed tristique consequat, diam lorem scelerisque felis, at dictum purus augue facilisis lorem. Duis pharetra dignissim rutrum. Curabitur ac elit id dui dapibus tincidunt. Nulla eget sem quam, non eleifend eros. Cras porttitor tempus lectus ac scelerisque. Curabitur vehicula bibendum lorem, vitae ornare ligula venenatis ut.
- "; + return <<+ Nulla facilisi. Curabitur lacinia, tellus sed tristique consequat, diam + lorem scelerisque felis, at dictum purus augue facilisis lorem. Duis + pharetra dignissim rutrum. Curabitur ac elit id dui dapibus tincidunt. + Nulla eget sem quam, non eleifend eros. Cras porttitor tempus lectus ac + scelerisque. Curabitur vehicula bibendum lorem, vitae ornare ligula + venenatis ut. +
+LIPSUM; } /** @@ -515,7 +574,14 @@ function panels_stylizer_lipsum() { */ function panels_stylizer_region_preview($plugin, $settings) { ctools_stylizer_add_css($plugin, $settings); - return theme($plugin['theme'], array('settings' => $settings, 'class' => ctools_stylizer_get_css_class($plugin, $settings), 'content' => panels_stylizer_lipsum())); + return theme( + $plugin['theme'], + array( + 'settings' => $settings, + 'class' => ctools_stylizer_get_css_class($plugin, $settings), + 'content' => panels_stylizer_lipsum(), + ) + ); } /** @@ -525,7 +591,7 @@ function panels_stylizer_pane_preview($plugin, $settings) { ctools_stylizer_add_css($plugin, $settings); $pane = new stdClass(); - $content = new stdClass; + $content = new stdClass(); $content->title = t('Lorem ipsum'); $content->content = panels_stylizer_lipsum(); $content->type = 'dummy'; @@ -536,78 +602,103 @@ function panels_stylizer_pane_preview($plugin, $settings) { $display = new panels_display(); if (!empty($plugin['theme'])) { - return theme($plugin['theme'], array('settings' => $settings, 'content' => $content, 'pane' => $pane, 'display' => $display)); + return theme( + $plugin['theme'], + array( + 'settings' => $settings, + 'content' => $content, + 'pane' => $pane, + 'display' => $display, + ) + ); } else { - return theme('panels_pane', array('content' => $content, 'pane' => $pane, 'display' => $display)); + return theme( + 'panels_pane', + array( + 'content' => $content, + 'pane' => $pane, + 'display' => $display, + ) + ); } } -// --------------------------------------------------------------------------- -// Panels display editing +/** + * Panels display editing. + */ /** - * @defgroup mainapi Functions comprising the main panels API - * @{ + * @defgroup mainapi Functions comprising the main panels API. */ /** * Main API entry point to edit a panel display. * - * Sample implementations utiltizing the the complex $destination behavior can be found - * in panels_page_edit_content() and, in a separate contrib module, OG Blueprints - * (http://drupal.org/project/og_blueprints), og_blueprints_blueprint_edit(). + * Sample implementations utiltizing the the complex $destination behavior can + * be found in panels_page_edit_content() and, in a separate contrib module, + * OG Blueprints (http://drupal.org/project/og_blueprints), + * og_blueprints_blueprint_edit(). + * + * @param object $display + * Instanceof panels_display. + * + * A fully loaded panels $display object, as returned from + * panels_load_display(). Merely passing a did is NOT sufficient. + * Note that 'fully loaded' means the $display must already be loaded with + * any contexts the caller wishes to have set for the display. + * @param mixed $destination + * The redirect destination that the user should be taken to on form + * submission or cancellation. With panels_edit, $destination has complex + * effects on the return values of panels_edit() once the form has been + * submitted. See the explanation of the return value below to understand the + * different types of values returned by panels_edit() at different stages of + * FAPI. Under most circumstances, simply passing in drupal_get_destination() + * is all that's necessary. + * @param array $content_types + * An associative array of allowed content types, typically as returned from + * panels_common_get_allowed_types(). Note that context partially governs + * available content types, so you will want to create any relevant contexts + * using panels_create_context() or panels_create_context_empty() to make sure + * all the appropriate content types are available. + * + * @return mixed + * Because the functions called by panels_edit() invoke the form API, + * this function returns different values depending on the stage of form + * submission we're at. In Drupal 5, the phase of form submission is indicated + * by the contents of $_POST['op']. Here is what you'll get at different + * stages: + * - If !$_POST['op']: then we're on on the initial passthrough and the + * form is being rendered, so it's the $form itself that's being + * returned. Because negative margins, a common CSS technique, bork the + * display editor's ajax drag-and-drop, it's important that the $output + * be printed, not returned. Use this syntax in the caller function: + * print theme('page', panels_edit($display, $destination, $content_types), FALSE); + * - If $_POST['op'] == t('Cancel'): form submission has been cancelled. + * If empty($destination) == FALSE, then there is no return value and the + * panels API takes care of redirecting to $destination. + * If empty($destination) == TRUE, then there's still no return value, + * but the caller function has to take care of form redirection. + * - If $_POST['op'] == ('Save'): the form has been submitted successfully + * and has run through panels_edit_display_submit(). + * $output depends on the value of $destination: + * - If empty($destination) == TRUE: $output contains the modified $display + * object, and no redirection will occur. This option is useful if the + * caller needs to perform additional operations on or with the modified + * $display before the page request is complete. Using hook_form_alter() + * to add an additional submit handler is typically the preferred method + * for something like this, but there are certain use cases where that is + * infeasible and $destination = NULL should be used instead. If this + * method is employed, the caller will need to handle form redirection. + * Note that having $_REQUEST['destination'] set, whether via + * drupal_get_destination() or some other method, will NOT interfere with + * this functionality; consequently, you can use drupal_get_destination() + * to safely store your desired redirect in the caller function, then + * simply use drupal_goto() once panels_edit() has done its business. + * - If empty($destination) == FALSE: the form will redirect to the URL + * string given in $destination and NO value will be returned. * * @ingroup mainapi - * - * @param object $display instanceof panels_display \n - * A fully loaded panels $display object, as returned from panels_load_display(). - * Merely passing a did is NOT sufficient. \n - * Note that 'fully loaded' means the $display must already be loaded with any contexts - * the caller wishes to have set for the display. - * @param mixed $destination \n - * The redirect destination that the user should be taken to on form submission or - * cancellation. With panels_edit, $destination has complex effects on the return - * values of panels_edit() once the form has been submitted. See the explanation of - * the return value below to understand the different types of values returned by panels_edit() - * at different stages of FAPI. Under most circumstances, simply passing in - * drupal_get_destination() is all that's necessary. - * @param array $content_types \n - * An associative array of allowed content types, typically as returned from - * panels_common_get_allowed_types(). Note that context partially governs available content types, - * so you will want to create any relevant contexts using panels_create_context() or - * panels_create_context_empty() to make sure all the appropriate content types are available. - * - * @return - * Because the functions called by panels_edit() invoke the form API, this function - * returns different values depending on the stage of form submission we're at. In Drupal 5, - * the phase of form submission is indicated by the contents of $_POST['op']. Here's what you'll - * get at different stages: - * -# If !$_POST['op']: then we're on on the initial passthrough and the form is being - * rendered, so it's the $form itself that's being returned. Because negative margins, - * a common CSS technique, bork the display editor's ajax drag-and-drop, it's important - * that the $output be printed, not returned. Use this syntax in the caller function: \n - * print theme('page', panels_edit($display, $destination, $content_types), FALSE); \n - * -# If $_POST['op'] == t('Cancel'): form submission has been cancelled. If empty($destination) == FALSE, - * then there is no return value and the panels API takes care of redirecting to $destination. - * If empty($destination) == TRUE, then there's still no return value, but the caller function - * has to take care of form redirection. - * -# If $_POST['op'] == ('Save'): the form has been submitted successfully and has run through - * panels_edit_display_submit(). $output depends on the value of $destination: - * - If empty($destination) == TRUE: $output contains the modified $display - * object, and no redirection will occur. This option is useful if the caller - * needs to perform additional operations on or with the modified $display before - * the page request is complete. Using hook_form_alter() to add an additional submit - * handler is typically the preferred method for something like this, but there - * are certain use cases where that is infeasible and $destination = NULL should - * be used instead. If this method is employed, the caller will need to handle form - * redirection. Note that having $_REQUEST['destination'] set, whether via - * drupal_get_destination() or some other method, will NOT interfere with this - * functionality; consequently, you can use drupal_get_destination() to safely store - * your desired redirect in the caller function, then simply use drupal_goto() once - * panels_edit() has done its business. - * - If empty($destination) == FALSE: the form will redirect to the URL string - * given in $destination and NO value will be returned. */ function panels_edit($display, $destination = NULL, $content_types = NULL, $title = FALSE) { ctools_include('display-edit', 'panels'); @@ -619,40 +710,47 @@ function panels_edit($display, $destination = NULL, $content_types = NULL, $titl /** * API entry point for selecting a layout for a given display. * - * Layout selection is nothing more than a list of radio items encompassing the available - * layouts for this display, as defined by .inc files in the panels/layouts subdirectory. - * The only real complexity occurs when a user attempts to change the layout of a display - * that has some content in it. + * Layout selection is nothing more than a list of radio items encompassing the + * available layouts for this display, as defined by .inc files in the + * panels/layouts subdirectory. The only real complexity occurs when a user + * attempts to change the layout of a display that has some content in it. * - * @param object $display instanceof panels_display \n - * A fully loaded panels $display object, as returned from panels_load_display(). - * Merely passing a did is NOT sufficient. + * @param object $display + * A fully loaded panels $display object, as returned from + * panels_load_display(). Merely passing a did is NOT sufficient. * @param string $finish - * A string that will be used for the text of the form submission button. If no value is provided, - * then the form submission button will default to t('Save'). + * A string that will be used for the text of the form submission button. If + * no value is provided, then the form submission button will default to + * t('Save'). * @param mixed $destination - * Basic usage is a string containing the URL that the form should redirect to upon submission. - * For a discussion of advanced usages, see panels_edit(). + * Basic usage is a string containing the URL that the form should redirect to + * upon submission. For a discussion of advanced usages, see panels_edit(). * @param mixed $allowed_layouts - * Allowed layouts has three different behaviors that depend on which of three value types - * are passed in by the caller: - * #- if $allowed_layouts instanceof panels_allowed_layouts (includes subclasses): the most - * complex use of the API. The caller is passing in a loaded panels_allowed_layouts object - * that the client module previously created and stored somewhere using a custom storage - * mechanism. - * #- if is_string($allowed_layouts): the string will be used in a call to variable_get() which - * will call the $allowed_layouts . '_allowed_layouts' var. If the data was stored properly - * in the system var, the $allowed_layouts object will be unserialized and recreated. - * @see panels_common_set_allowed_layouts() - * #- if is_null($allowed_layouts): the default behavior, which also provides backwards - * compatibility for implementations of the Panels2 API written before beta4. In this case, - * a dummy panels_allowed_layouts object is created which does not restrict any layouts. - * Subsequent behavior is indistinguishable from pre-beta4 behavior. + * Allowed layouts has three different behaviors that depend on which of three + * value types are passed in by the caller: + * #- if $allowed_layouts instanceof panels_allowed_layouts + * (includes subclasses): the most complex use of the API. The caller is + * passing in a loaded panels_allowed_layouts object that the client + * module previously created and stored somewhere using a custom storage + * mechanism. + * #- if is_string($allowed_layouts): the string will be used in a call to + * variable_get() which will call the + * $allowed_layouts . '_allowed_layouts' var. If the data was stored + * properly in the system var, the $allowed_layouts object will be + * unserialized and recreated. + * #- if is_null($allowed_layouts): the default behavior, which also + * provides backwards compatibility for implementations of the Panels2 + * API written before beta4. In this case, a dummy panels_allowed_layouts + * object is created which does not restrict any layouts. Subsequent + * behavior is indistinguishable from pre-beta4 behavior. + * + * @return mixed + * Can return nothing, or a modified $display object, or a redirection string; + * return values for the panels_edit* family of functions are quite complex. + * See panels_edit() for detailed discussion. * - * @return - * Can return nothing, or a modified $display object, or a redirection string; return values for the - * panels_edit* family of functions are quite complex. See panels_edit() for detailed discussion. * @see panels_edit() + * @see panels_common_set_allowed_layouts() */ function panels_edit_layout($display, $finish, $destination = NULL, $allowed_layouts = NULL) { ctools_include('display-layout', 'panels'); @@ -660,23 +758,27 @@ function panels_edit_layout($display, $finish, $destination = NULL, $allowed_lay return _panels_edit_layout($display, $finish, $destination, $allowed_layouts); } -// --------------------------------------------------------------------------- -// Panels database functions +/** + * Panels database functions. + */ /** - * Forms the basis of a panel display + * Forms the basis of a panel display. */ class panels_display { - var $args = array(); - var $content = array(); - var $panels = array(); - var $incoming_content = NULL; - var $css_id = NULL; - var $context = array(); - var $did = 'new'; - var $renderer = 'standard'; + public $args = array(); + public $content = array(); + public $panels = array(); + public $incoming_content = NULL; + public $css_id = NULL; + public $context = array(); + public $did = 'new'; + public $renderer = 'standard'; - function add_pane(&$pane, $location = NULL) { + /** + * Add a pane. + */ + public function add_pane(&$pane, $location = NULL) { // If no location specified, use what's set in the pane. if (empty($location)) { $location = $pane->panel; @@ -690,33 +792,30 @@ class panels_display { $pane->uuid = ctools_uuid_generate(); $pane->pid = 'new-' . $pane->uuid; - // Add the pane to the approprate spots. + // Add the pane to the appropriate spots. $this->content[$pane->pid] = &$pane; $this->panels[$location][] = $pane->pid; } - function duplicate_pane($pid, $location = FALSE) { + /** + * Duplicate a pane. + */ + public function duplicate_pane($pid, $location = FALSE) { $pane = $this->clone_pane($pid); $this->add_pane($pane, $location); } - function clone_pane($pid) { - $pane = clone $this->content[$pid]; - $pane->uuid = ctools_uuid_generate(); - return $pane; - } - /** * Get the title from a display. * * The display must have already been rendered, or the setting to set the * display's title from a pane's title will not have worked. * - * @return - * The title to use. If NULL, this means to let any default title that may be in use - * pass through. i.e, do not actually set the title. + * @return mixed + * The title to use. If NULL, this means to let any default title that may + * be in use pass through. i.e, do not actually set the title. */ - function get_title() { + public function get_title() { switch ($this->hide_title) { case PANELS_TITLE_NONE: return ''; @@ -725,7 +824,8 @@ class panels_display { return isset($this->stored_pane_title) ? $this->stored_pane_title : ''; case PANELS_TITLE_FIXED: - case FALSE; // For old exported panels that are not in the database. + case FALSE; + // For old exported panels that are not in the database. if (!empty($this->title)) { return filter_xss_admin(ctools_context_keyword_substitute($this->title, array(), $this->context)); } @@ -743,8 +843,11 @@ class panels_display { * An instantiated display renderer object, or the name of a display * renderer plugin+class to be fetched. Defaults to NULL. When NULL, the * predesignated display renderer will be used. + * + * @return mixed + * NULL or output of render function. */ - function render($renderer = NULL) { + public function render($renderer = NULL) { $layout = panels_get_layout($this->layout); if (!$layout) { return NULL; @@ -788,7 +891,7 @@ class panels_display { * @return bool * TRUE if access is granted; otherwise FALSE. */ - function access($op, $account = NULL) { + public function access($op, $account = NULL) { global $user; if (!$account) { @@ -825,10 +928,11 @@ class panels_display { return $access_callback($this->storage_type, $this->storage_id, $op, $account); } + } /** - * }@ End of 'defgroup mainapi', although other functions are specifically added later + * End of 'defgroup mainapi', although other functions are specifically added later. */ /** @@ -869,10 +973,10 @@ function panels_new_pane($type, $subtype, $set_defaults = FALSE) { * Helper function primarily for for panels_load_display(). * * @param array $dids - * An indexed array of dids to be loaded from the database. + * An indexed array of dids to be loaded from the database. * - * @return $displays - * An array of displays, keyed by their display dids. + * @return array + * An array of displays, keyed by their display dids. * * @todo schema API can drasticly simplify this code. */ @@ -882,7 +986,10 @@ function panels_load_displays($dids) { return $displays; } - $result = db_query("SELECT * FROM {panels_display} WHERE did IN (:dids)", array(':dids' => $dids)); + $result = db_query( + "SELECT * FROM {panels_display} WHERE did IN (:dids)", + array(':dids' => $dids) + ); ctools_include('export'); foreach ($result as $obj) { @@ -890,28 +997,28 @@ function panels_load_displays($dids) { // Modify the hide_title field to go from a bool to an int if necessary. } - $result = db_query("SELECT * FROM {panels_pane} WHERE did IN (:dids) ORDER BY did, panel, position", array(':dids' => $dids)); + $result = db_query( + "SELECT * FROM {panels_pane} WHERE did IN (:dids) ORDER BY did, panel, position", + array(':dids' => $dids) + ); foreach ($result as $obj) { $pane = ctools_export_unpack_object('panels_pane', $obj); $displays[$pane->did]->panels[$pane->panel][] = $pane->pid; $displays[$pane->did]->content[$pane->pid] = $pane; } - return $displays; } /** * Load a single display. * - * @ingroup mainapi - * * @param int $did - * The display id (did) of the display to be loaded. + * The display id (did) of the display to be loaded. * - * @return object $display instanceof panels_display \n - * Returns a partially-loaded panels_display object. $display objects returned from - * from this function have only the following data: + * @return object $display + * Returns a partially-loaded panels_display object. $display objects returned + * from this function have only the following data: * - $display->did (the display id) * - $display->name (the 'name' of the display, where applicable - it often isn't) * - $display->layout (a string with the system name of the display's layout) @@ -923,9 +1030,10 @@ function panels_load_displays($dids) { * - $display->cache (any relevant data from panels_simple_cache) * - $display->args * - $display->incoming_content + * While all of these members are defined, $display->context is NEVER defined in the returned $display; + * it must be set using one of the ctools_context_create() functions. * - * While all of these members are defined, $display->context is NEVER defined in the returned $display; - * it must be set using one of the ctools_context_create() functions. + * @ingroup mainapi */ function panels_load_display($did) { $displays = panels_load_displays(array($did)); @@ -937,8 +1045,6 @@ function panels_load_display($did) { /** * Save a display object. * - * @ingroup mainapi - * * Note that a new $display only receives a real did once it is run through * this function, and likewise for the pid of any new pane. * @@ -947,11 +1053,14 @@ function panels_load_display($did) { * universally-unique identifier (which is stored permanently in the 'uuid' * field). This format is also used in place of the real pid for exports. * - * @param object $display instanceof panels_display \n - * The display object to be saved. Passed by reference so the caller need not use - * the return value for any reason except convenience. + * @param object $display + * The display object to be saved. Passed by reference so the caller need not + * use the return value for any reason except convenience. * - * @return object $display instanceof panels_display \n + * @return object $display + * This display panel display object to return. + * + * @ingroup mainapi */ function panels_save_display(&$display) { $update = (isset($display->did) && is_numeric($display->did)) ? array('did') : array(); @@ -962,15 +1071,19 @@ function panels_save_display(&$display) { $pids = array(); if ($update) { - // Get a list of all panes currently in the database for this display so we can know if there - // are panes that need to be deleted. (i.e, aren't currently in our list of panes). - $result = db_query("SELECT pid FROM {panels_pane} WHERE did = :did", array(':did' => $display->did)); + // Get a list of all panes currently in the database for this display so we + // can know if there are panes that need to be deleted. (i.e, aren't + // currently in our list of panes). + $result = db_query( + "SELECT pid FROM {panels_pane} WHERE did = :did", + array(':did' => $display->did) + ); foreach ($result as $pane) { $pids[$pane->pid] = $pane->pid; } } - // update all the panes + // Update all the panes. ctools_include('plugins', 'panels'); ctools_include('content'); @@ -1007,7 +1120,7 @@ function panels_save_display(&$display) { // Remove the old new-* entry from the displays content. unset($display->content[$pid]); - // and put it back so our pids and positions can be used. + // Put it back so our pids and positions can be used. $display->content[$pane->pid] = $pane; // If the title pane was one of our panes that just got its ID changed, @@ -1019,7 +1132,7 @@ function panels_save_display(&$display) { // because it was needed to get the did. Chicken, egg, more chicken. db_update('panels_display') ->fields(array( - 'title_pane' => $pane->pid + 'title_pane' => $pane->pid, )) ->condition('did', $display->did) ->execute(); @@ -1049,7 +1162,7 @@ function panels_save_display(&$display) { // Allow other modules to take action when a display is saved. module_invoke_all('panels_display_save', $display); - // Log the change to watchdog, using the same style as node.module + // Log the change to watchdog, using the same style as node.module. $watchdog_args = array('%did' => $display->did); if (!empty($display->title)) { $watchdog_args['%title'] = $display->title; @@ -1059,7 +1172,7 @@ function panels_save_display(&$display) { watchdog('content', 'Panels: saved display with id %did', $watchdog_args, WATCHDOG_NOTICE); } - // to be nice, even tho we have a reference. + // To be nice, even though we have a reference. return $display; } @@ -1089,23 +1202,25 @@ function panels_delete_display($display) { * Only once panels_save_display() is called on the code version of $display * will the exported display be written to the database and permanently saved. * - * @see panels_page_export() or _panels_page_fetch_display() for sample implementations. - * - * @ingroup mainapi - * - * @param object $display instanceof panels_display \n - * This export function does no loading of additional data about the provided - * display. Consequently, the caller should make sure that all the desired data - * has been loaded into the $display before calling this function. + * @param object $display + * This export function does no loading of additional data about the provided + * display. Consequently, the caller should make sure that all the desired + * data has been loaded into the $display before calling this function. * @param string $prefix - * A string prefix that is prepended to each line of exported code. This is primarily - * used for prepending a double space when exporting so that the code indents and lines up nicely. + * A string prefix that is prepended to each line of exported code. This is + * primarily used for prepending a double space when exporting so that the + * code indents and lines up nicely. * * @return string $output - * The passed-in $display expressed as code, ready to be imported. Import by running - * eval($output) in the caller function; doing so will create a new $display variable - * with all the exported values. Note that if you have already defined a $display variable in - * the same scope as where you eval(), your existing $display variable WILL be overwritten. + * The passed-in $display expressed as code, ready to be imported. Import by + * running eval($output) in the caller function; doing so will create a new + * $display variable with all the exported values. Note that if you have + * already defined a $display variable in the same scope as where you eval(), + * your existing $display variable WILL be overwritten. + * + * @see panels_page_export() or _panels_page_fetch_display() for samples. + * + * @ingroup mainapi */ function panels_export_display($display, $prefix = '') { ctools_include('export'); @@ -1139,7 +1254,7 @@ function panels_export_display($display, $prefix = '') { if (!isset($region_counters[$pane->panel])) { $region_counters[$pane->panel] = 0; } - $output .= $prefix . '$display->panels[\'' . $pane->panel . '\'][' . $region_counters[$pane->panel]++ .'] = \'' . $pane->pid . "';\n"; + $output .= $prefix . '$display->panels[\'' . $pane->panel . '\'][' . $region_counters[$pane->panel]++ . '] = \'' . $pane->pid . "';\n"; } } $output .= $prefix . '$display->hide_title = '; @@ -1147,9 +1262,11 @@ function panels_export_display($display, $prefix = '') { case PANELS_TITLE_FIXED: $output .= 'PANELS_TITLE_FIXED'; break; + case PANELS_TITLE_NONE: $output .= 'PANELS_TITLE_NONE'; break; + case PANELS_TITLE_PANE: $output .= 'PANELS_TITLE_PANE'; break; @@ -1161,11 +1278,14 @@ function panels_export_display($display, $prefix = '') { } /** + * Panels Render Display. + * * Render a display by loading the content into an appropriate * array and then passing through to panels_render_layout. * * if $incoming_content is NULL, default content will be applied. Use * an empty string to indicate no content. + * * @ingroup hook_invocations */ function panels_render_display(&$display, $renderer = NULL) { @@ -1176,7 +1296,7 @@ function panels_render_display(&$display, $renderer = NULL) { if ($form_context = ctools_context_get_form($display->context)) { $form_context->form['#theme'] = 'panels_render_display_form'; if (empty($form_context->form['#theme_wrappers']) || !in_array('form', $form_context->form['#theme_wrappers'])) { - $form_context['#theme_wrappers'][] = 'form'; + $form_context->form['#theme_wrappers'][] = 'form'; } $form_context->form['#display'] = &$display; return $form_context->form; @@ -1197,16 +1317,32 @@ function theme_panels_render_display_form($vars) { return $vars['element']['#display']->render(); } -// @layout +/** + * Panels layout icon function. + */ function panels_print_layout_icon($id, $layout, $title = NULL) { ctools_add_css('panels_admin', 'panels'); $file = $layout['path'] . '/' . $layout['icon']; - return theme('panels_layout_icon', array('id' => $id, 'image' => theme('image', array('path' => $file, 'alt' => strip_tags($layout['title']), 'title' => strip_tags($layout['description']))), 'title' => $title)); + return theme( + 'panels_layout_icon', + array( + 'id' => $id, + 'image' => theme( + 'image', + array( + 'path' => $file, + 'alt' => strip_tags($layout['title']), + 'title' => strip_tags($layout['description']), + ) + ), + 'title' => $title, + ) + ); } /** - * Theme the layout icon image - * @layout + * Theme the layout icon image. + * * @todo move to theme.inc */ function theme_panels_layout_icon($vars) { @@ -1224,18 +1360,15 @@ function theme_panels_layout_icon($vars) { } /** - * Theme the layout link image + * Theme the layout link image. + * * @layout * * @todo Why isn't this a template at this point? * @todo Why does this take 4 arguments but only makes use of two? */ function theme_panels_layout_link($vars) { - $title = $vars['title']; - $image = $vars['image']; - $class = $vars['class']; - - $output = 'Enable the module to find additional region and pane styles in Panels. Below is a list of those currently included. Please share and contribute your styles! :)
+ +Wrap your panes and regions with unlimited possibilities.
+Sample output after applying the wrapper elements on 1 region and 2 content panes: the powered by block and a main menu.
+ +
+
+
+Hello World
+
+
+Main menu
+
+
+
+
+
+Wrap any region or pane with one of several dozen tags, including HTML5 elements.
+ + +Wrap any region or pane with a custom raw prefix and suffix.
+ + + + + +