| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Source view] [Print] [Project Stats]
(no description)
| File Size: | 573 lines (22 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
panels_allowed_layouts:: (16 methods):
panels_allowed_layouts()
set_allowed()
sync_with_available()
save()
list_layouts()
panels_common_settings()
panels_common_settings_validate()
panels_common_settings_submit()
panels_common_get_allowed_types()
panels_common_allowed_layouts_form()
panels_common_allowed_layouts_form_validate()
panels_common_allowed_layouts_form_submit()
panels_common_get_allowed_layout_object()
panels_common_get_allowed_layouts()
theme_panels_common_content_list()
panels_common_print_layout_links()
Class: panels_allowed_layouts - X-Ref
Class definition for the allowed layouts governing structure.| panels_allowed_layouts($start_allowed = TRUE) X-Ref |
| Constructor function; loads the $allowed_layout_settings array with initial values according to $start_allowed param: bool $start_allowed |
| set_allowed($title = 'Panels: Allowed Layouts') X-Ref |
| Manage panels_common_set_allowed_layouts(), the FAPI code for selecting allowed layouts. MAKE SURE to set panels_allowed_layouts::allow_new before calling this method. If you want the panels API to handle saving these allowed layout settings, panels_allowed_layouts::module_name must also be set. Below is a sample implementation; refer to the rest of the class documentation to understand all the specific pieces. Values that are intended to be replaced are wrapped with <>. \n @code function docdemo_allowed_layouts() { ctools_include('common', 'panels'); if (!is_a($allowed_layouts = unserialize(variable_get('panels_common_allowed_layouts', serialize(''))), 'panels_allowed_layouts')) { $allowed_layouts = new panels_allowed_layouts(); $allowed_layouts->allow_new = TRUE; $allowed_layouts->module_name = '<client_module_name>'; } $result = $allowed_layouts->set_allowed('<Desired client module form title>'); if (in_array($allowed_layouts->form_state, array('failed-validate', 'render'))) { return $result; } elseif ($allowed_layouts->form_state == 'submit') { drupal_goto('</path/to/desired/redirect>'); } } param: string $title return: mixed $result |
| sync_with_available() X-Ref |
| Checks for newly-added layouts and deleted layouts. If any are found, updates panels_allowed_layouts::allowed_layout_settings; new additions are made according to panels_allowed_layouts::allow_new, while deletions are unset(). Note that any changes made by this function are not saved in any permanent location. |
| save() X-Ref |
| Use panels_allowed_layouts::module_name to generate a variable for variable_set(), in which a serialized version of $this will be stored. Does nothing if panels_allowed_layouts::module_name is not set. IMPORTANT NOTE: if you use variable_get() in a custom client module save() method, you MUST wrap $this in serialize(), then unserialize() what you get from variable_get(). Failure to do so will result in an incomplete object. The following code will work: |
| list_layouts() X-Ref |
| Snag a list of the current layouts for internal use. Data is not saved in a class member in order to ensure that it's fresh. return: array $layouts |
| panels_common_settings(&$form_state, $module_name = 'panels_common') X-Ref |
| A common settings page for Panels modules, because this code is relevant to any modules that don't already have special requirements. |
| panels_common_settings_validate($form, &$form_state) X-Ref |
| Submit hook for panels_common_settings |
| panels_common_settings_submit($form, &$form_state) X-Ref |
| Submit hook for panels_common_settings |
| panels_common_get_allowed_types($module, $contexts = array() X-Ref |
| Based upon the settings, get the allowed types for this node. |
| panels_common_allowed_layouts_form(&$form, &$form_state, $module_name) X-Ref |
| The FAPI code for generating an 'allowed layouts' selection form. NOTE: Because the Panels API does not guarantee a particular method of storing the data on allowed layouts, it is not_possible for the Panels API to implement any checks that determine whether reductions in the set of allowed layouts conflict with pre-existing layout selections. $displays in that category will continue to function with their current layout as normal until the user/owner/admin attempts to change layouts on that display, at which point they will have to select from the new set of allowed layouts. If this is not the desired behavior for your client module, it's up to you to write a validation routine that determines what should be done with conflicting layouts. Remember that changing layouts where panes have already been created can result in data loss; consult panels_change_layout() to see how the Panels API handles that process. Running drupal_execute('panels_change_layout', ...) is one possible starting point. param: array $allowed_layouts |
| panels_common_allowed_layouts_form_validate($form, &$form_state) X-Ref |
| No description |
| panels_common_allowed_layouts_form_submit($form, &$form_state) X-Ref |
| No description |
| panels_common_get_allowed_layout_object($module_name) X-Ref |
| Get the allowed layout object for the given module. |
| panels_common_get_allowed_layouts($module_name) X-Ref |
| Get the allowed layouts for the given module. |
| theme_panels_common_content_list($display) X-Ref |
| Create a visible list of content in a display. Note that the contexts must be pre-loaded. |
| panels_common_print_layout_links($layouts, $base_path, $link_options = array() X-Ref |
| Print a selector of layouts, each linked to the next step. Most operations use radio buttons for selecting layouts, but some will give each layout as a link that goes to the next step. This function makes it easy to simply provide a list of allowed layouts and the base path. One limitation is that it will only append the layout name to the end, so if the actual layout name is needed in the middle, that can't happen. return: |
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |