Definition in file panels.module.
Go to the source code of this file.
Classes | |
| class | panels_display |
Functions | |
| panels_add_button ($image, $name, $text, $class, $id=NULL) | |
| panels_ajax_form ($form_id, $title, $url) | |
| panels_ajax_passthru () | |
| panels_ajax_render ($output=NULL, $title=NULL, $url=NULL) | |
| panels_api_version () | |
| panels_cache_clear ($did) | |
| panels_cache_get ($did) | |
| panels_cache_set ($did, $cache) | |
| panels_common_cache_clear ($obj, $did) | |
| panels_common_cache_get ($obj, $did, $skip_cache=FALSE) | |
| panels_common_cache_set ($obj, $did, $cache) | |
| panels_cron () | |
| panels_delete_display ($display) | |
| panels_edit ($display, $destination=NULL, $content_types=NULL) | |
| panels_edit_layout ($display, $finish, $destination=NULL, $allowed_layouts=NULL) | |
| panels_edit_layout_settings ($display, $finish, $destination=NULL, $title=FALSE) | |
| panels_elements () | |
| panels_export_display ($display, $prefix= '') | |
| panels_export_pane ($pane, $prefix= '') | |
| panels_get ($var) | |
| panels_get_panel_style_and_settings ($panel_settings, $panel) | |
| panels_get_path ($file, $base_path=false, $module= 'panels') | |
| panels_help ($section=NULL) | |
| panels_imagebutton_value () | |
| panels_load_display ($did) | |
| panels_load_displays ($dids) | |
| panels_load_include ($include, $path= 'includes/') | |
| panels_menu ($may_cache) | |
| panels_new_display () | |
| panels_nid_autocomplete ($int) | |
| panels_node_autocomplete ($string) | |
| panels_node_type ($op, $info) | |
| panels_perm () | |
| panels_print_layout ($id, $content) | |
| panels_print_layout_icon ($id, $layout, $title=NULL) | |
| panels_print_layout_link ($id, $layout, $link) | |
| panels_render_display (&$display) | |
| panels_render_layout ($layout, $content, $css_id=NULL, $settings=array()) | |
| panels_render_pane ($content, $pane, $display) | |
| panels_render_pane_content (&$display, &$pane) | |
| panels_render_panel ($display, $panel, $panes) | |
| panels_render_panes ($display) | |
| panels_sanitize_display (&$display) | |
| panels_save_display (&$display) | |
| panels_set ($var, $value=NULL) | |
| panels_var_export ($object, $prefix= '') | |
| theme_panels_imagebutton ($element) | |
| theme_panels_layout_icon ($id, $image, $title=NULL) | |
| theme_panels_layout_link ($title, $id, $image, $link) | |
| theme_panels_pane ($content, $pane, $display) | |
| panels_add_button | ( | $ | image, | |
| $ | name, | |||
| $ | text, | |||
| $ | class, | |||
| $ | id = NULL | |||
| ) |
Add a single button to a form.
Definition at line 279 of file panels.module.
References panels_get_path().
Referenced by panels_common_add_item_to_form(), panels_content_config_add_form_submit(), and panels_edit_display().
00279 { 00280 return array( 00281 '#type' => 'panels_imagebutton', 00282 '#image' => panels_get_path('images/' . $image), 00283 '#title' => $text, 00284 '#default_value' => $name, 00285 '#class' => $class, 00286 '#id' => $id, 00287 ); 00288 }
| panels_ajax_form | ( | $ | form_id, | |
| $ | title, | |||
| $ | url | |||
| ) |
Handle a form for AJAX in a manner that happens to be basically the opposite of the normal flow; if the form hasn't been processed, just render it and exit; if it has been submitted successfuly, however, then we return whatever the submit function returned and do our next step accordingly.
| $form_id | The id of the form | |
| $title | The title for the modal dialog, if rendered. | |
| $url | The next URL to go to; may be NULL. | |
| ... | Any arguments that go to the form. |
Definition at line 208 of file panels.module.
References panels_ajax_render().
Referenced by panels_ajax_add_config(), panels_ajax_cache(), panels_ajax_cache_settings(), panels_ajax_configure(), and panels_panel_settings_ajax().
00208 { 00209 $args = func_get_args(); 00210 00211 // Remove the $title and $url 00212 array_splice($args, 1, 2); 00213 00214 $form = call_user_func_array('drupal_retrieve_form', $args); 00215 $form['#redirect'] = FALSE; 00216 00217 $result = drupal_process_form($form_id, $form); 00218 if (isset($result)) { 00219 return $result; 00220 } 00221 00222 // If the form wasn't submitted successfully, render the form. 00223 $output = theme('status_messages'); 00224 $output .= drupal_render_form($form_id, $form); 00225 panels_ajax_render($output, $title, $url); 00226 }
| panels_ajax_passthru | ( | ) |
Helper function for our AJAX stuff to call through to the right location
Definition at line 147 of file panels.module.
References panels_load_include().
00147 { 00148 $args = func_get_args(); 00149 $callback = array_shift($args); 00150 00151 panels_load_include('plugins'); 00152 if (arg(1) == 'common') { 00153 panels_load_include('common'); 00154 } 00155 else { 00156 panels_load_include('display_edit'); 00157 } 00158 return call_user_func_array($callback, $args); 00159 }
| panels_ajax_render | ( | $ | output = NULL, |
|
| $ | title = NULL, |
|||
| $ | url = NULL | |||
| ) |
Simple render function to make sure output is what we want.
Definition at line 166 of file panels.module.
Referenced by panels_ajax(), panels_ajax_add_config(), panels_ajax_add_content(), panels_ajax_cache(), panels_ajax_cache_settings(), panels_ajax_configure(), panels_ajax_form(), panels_ajax_toggle_shown(), panels_common_ajax(), panels_common_ajax_context_item_add(), panels_common_ajax_context_item_edit(), panels_edit_submit_subform(), and panels_panel_settings_ajax().
00166 { 00167 if (!is_object($output)) { 00168 $temp = new stdClass(); 00169 $temp->output = $output; 00170 switch ($output) { 00171 case 'dismiss': 00172 $temp->type = $output; 00173 break; 00174 00175 default: 00176 $temp->type = 'display'; 00177 } 00178 $temp->title = $title; 00179 $temp->url = $url; 00180 $output = $temp; 00181 } 00182 if (!$output->output || !$output->type) { 00183 $output->output = t('The input was invalid'); 00184 $output->type = 'display'; 00185 $output->title = t('Error'); 00186 } 00187 drupal_set_header('Content-Type: text/javascript; charset=utf-8'); 00188 print drupal_to_js($output); 00189 exit; 00190 }
| panels_api_version | ( | ) |
Returns the API version of Panels. This didn't exist in 1.
Definition at line 32 of file panels.module.
| panels_cache_clear | ( | $ | did | ) |
Clear a display from the cache; used if the editing is aborted.
Definition at line 311 of file panels.module.
References panels_common_cache_clear().
Referenced by _panels_edit(), and panels_edit_display_submit().
00311 { 00312 return panels_common_cache_clear('panels', $did); 00313 }
| panels_cache_get | ( | $ | did | ) |
Get a display from the cache; this is used if the display is currently being edited, which can be a seriously multi-step process.
Definition at line 297 of file panels.module.
References panels_common_cache_get().
Referenced by _panels_edit(), panels_ajax(), panels_ajax_add_config(), panels_ajax_add_content(), panels_ajax_cache(), panels_ajax_configure(), and panels_ajax_toggle_shown().
00297 { 00298 return panels_common_cache_get('panels', $did); 00299 }
| panels_cache_set | ( | $ | did, | |
| $ | cache | |||
| ) |
Save the edited display into the cache.
Definition at line 304 of file panels.module.
References panels_common_cache_set().
Referenced by _panels_edit(), panels_ajax_add_config(), panels_ajax_cache_settings(), panels_ajax_configure(), panels_ajax_toggle_shown(), panels_content_config_form(), and panels_content_config_form_submit().
00304 { 00305 return panels_common_cache_set('panels', $did, $cache); 00306 }
| panels_common_cache_clear | ( | $ | obj, | |
| $ | did | |||
| ) |
Clear a display from the cache; used if the editing is aborted.
Definition at line 348 of file panels.module.
Referenced by panels_cache_clear(), panels_common_cache_set(), panels_mini_context_form_submit(), panels_node_context_form_submit(), panels_page_context_form_submit(), and panels_panel_settings_submit().
00348 { 00349 db_query("DELETE FROM {panels_object_cache} WHERE sid = '%s' AND obj = '%s' AND did = %d", session_id(), $obj, $did); 00350 }
| panels_common_cache_get | ( | $ | obj, | |
| $ | did, | |||
| $ | skip_cache = FALSE | |||
| ) |
Get an object from cache.
Definition at line 321 of file panels.module.
Referenced by panels_cache_get(), panels_common_ajax_context_item_add(), panels_common_ajax_context_item_edit(), panels_mini_edit_context(), panels_node_context_edit(), panels_page_edit_context(), panels_panel_settings(), panels_panel_settings_ajax(), and panels_panel_settings_validate().
00321 { 00322 static $cache = array(); 00323 $key = "$obj:$did"; 00324 if ($skip_cache) { 00325 unset($cache[$key]); 00326 } 00327 00328 if (!array_key_exists($key, $cache)) { 00329 $data = db_fetch_object(db_query("SELECT * FROM {panels_object_cache} WHERE sid = '%s' AND obj = '%s' AND did = %d", session_id(), $obj, $did)); 00330 if ($data) { 00331 $cache[$key] = unserialize($data->data); 00332 } 00333 } 00334 return isset($cache[$key]) ? $cache[$key] : NULL; 00335 }
| panels_common_cache_set | ( | $ | obj, | |
| $ | did, | |||
| $ | cache | |||
| ) |
Save the edited display into the cache.
Definition at line 340 of file panels.module.
References panels_common_cache_clear().
Referenced by panels_cache_set(), panels_common_ajax_context_item_add(), panels_common_ajax_context_item_edit(), panels_mini_edit_context(), panels_node_context_edit(), panels_page_edit_context(), panels_panel_settings(), and panels_panel_settings_ajax().
00340 { 00341 panels_common_cache_clear($obj, $did); 00342 db_query("INSERT INTO {panels_object_cache} (sid, obj, did, data, timestamp) VALUES ('%s', '%s', %d, '%s', %d)", session_id(), $obj, $did, serialize($cache), time()); 00343 }
| panels_cron | ( | ) |
Clean up old caches
Definition at line 355 of file panels.module.
00355 { 00356 // delete anything 7 days old or more. 00357 db_query("DELETE FROM {panels_object_cache} WHERE timestamp < %d", time() - (86400 * 7)); 00358 }
| panels_elements | ( | ) |
Custom form element to do our nice images.
Definition at line 251 of file panels.module.
00251 { 00252 $type['panels_imagebutton'] = array('#input' => TRUE, '#button_type' => 'submit'); 00253 return $type; 00254 }
| panels_export_pane | ( | $ | pane, | |
| $ | prefix = '' | |||
| ) |
Definition at line 877 of file panels.module.
References panels_var_export().
Referenced by panels_export_display().
00877 { 00878 $output = ''; 00879 $output = $prefix . '$pane = new stdClass()' . ";\n"; 00880 $fields = array('pid', 'panel', 'type', 'subtype', 'shown', 'access', 'visibility', 'configuration', 'cache'); 00881 foreach ($fields as $field) { 00882 $output .= "$prefix " . '$pane->' . $field . ' = ' . panels_var_export($pane->$field, "$prefix ") . ";\n"; 00883 } 00884 return $output; 00885 }
| panels_get | ( | $ | var | ) |
Retrieve from global storage
Definition at line 375 of file panels.module.
References panels_set().
Referenced by panels_edit_submit_subform().
00375 { 00376 return panels_set($var); 00377 }
| panels_get_panel_style_and_settings | ( | $ | panel_settings, | |
| $ | panel | |||
| ) |
Given a display and the id of a panel, get the style in which to render that panel.
Definition at line 1151 of file panels.module.
References panels_get_style().
Referenced by panels_render_panel().
01151 { 01152 if (empty($panel_settings)) { 01153 return array(panels_get_style('default'), array()); 01154 } 01155 01156 if (empty($panel_settings['individual']) || empty($panel_settings['panel'][$panel]['style'])) { 01157 $style = panels_get_style($panel_settings['style']); 01158 $style_settings = $panel_settings['style_settings']['default']; 01159 } 01160 else { 01161 $style = panels_get_style($panel_settings['panel'][$panel]['style']); 01162 $style_settings = $panel_settings['style_settings'][$panel]; 01163 } 01164 01165 return array($style, $style_settings); 01166 }
| panels_get_path | ( | $ | file, | |
| $ | base_path = false, |
|||
| $ | module = 'panels' | |||
| ) |
panels path helper function
Definition at line 231 of file panels.module.
Referenced by _panels_js_files(), panels_add_button(), panels_add_content(), panels_admin_content_types_custom(), panels_admin_content_types_custom_php(), panels_admin_content_types_form(), panels_admin_content_types_node_attachments(), panels_admin_content_types_node_book_nav(), panels_admin_content_types_node_comment_form(), panels_admin_content_types_node_comments(), panels_admin_content_types_node_content(), panels_admin_content_types_node_form(), panels_admin_content_types_node_meta(), panels_admin_content_types_node_type_desc(), panels_admin_content_types_term_description(), panels_admin_content_types_term_list(), panels_admin_content_types_user_picture(), panels_admin_content_types_user_profile(), panels_admin_content_types_vocabulary_terms(), panels_choose_layout(), panels_common_add_context_js(), panels_common_set_allowed_layouts(), panels_common_settings(), panels_edit_display(), panels_flexible_settings_form(), panels_load_include(), panels_menu(), panels_mini_content_types(), panels_mini_context_form(), panels_mini_edit_form(), panels_node_context_form(), panels_page_advanced_form(), panels_page_context_form(), panels_page_edit_form(), panels_panel_settings(), panels_print_layout_icon(), panels_print_layout_link(), panels_profile_fields_content_type(), panels_render_layout(), panels_views_content_types(), theme_panels_export_export_form(), theme_panels_hidden(), and theme_rounded_corners_css().
00231 { 00232 if ($base_path) { 00233 $output = base_path(); 00234 } 00235 return $output . drupal_get_path('module', $module) . '/' . $file; 00236 }
| panels_help | ( | $ | section = NULL |
) |
Definition at line 9 of file panels.module.
00009 { 00010 $output = ''; 00011 switch ($section) { 00012 case 'admin/help#panels': 00013 case 'admin/panels': 00014 $output = '<p>'. t(' Panels module is the core engine for a number of sub-modules, including Panels pages, Panels nodes, Mini panels, and Views panes. Panels module allows the website adminstrator (or sometimes the end-user) to manipulate the layout of individual pages, sidebars, and content pieces, as well as easily dictate what content is displayed in the layout.') .'</p>'; 00015 $output .= '<p>'. t('Most Drupal users are familiar with the block to region layout mechanism in which you can assign a block to any region defined in your theme. Panels takes this concept a massive step forward. Through the panels interface you can start by creating a layout with any number of columns, headers, and footer, and control the width of those areas.') .'</p>'; 00016 $output .= '<p>'. t('After creating your layout, you can assign pieces of content to those areas in an easy drag and drop interface. Content is not limited to blocks, but can be nodes, views, or other types of content that expose themselves to panels.') .'</p>'; 00017 $output .= '<p><b>'. t('Panel pages') .'</b>'. t(' are the the primary panels module, you can use this for creating single full page layouts. This replaces the standard panel that existed in the earlier versions of panels. If you are upgrading your site from Panels 1, and you cannot find where your panels went, be sure to enable the panel pages module!') .'</p>'; 00018 $output .= '<p><b>'. t('Panel nodes') .'</b>'. t(' are useful for creating layouts that only occupy the content area of your pages. Frequently, it is desirable to add an area to a node layout, such as a pull quote for a newspaper or a photo block, that you don\'t necessarily want on every node. Panels Nodes lets you control the layout of a single node at a time and place content such as blog posts, images, blogs in and around the post.') .'</p>'; 00019 $output .= '<p><b>'. t('Mini panels') .'</b>'. t(' are a layout mechanism for blocks. It won\'t take long using panels before you get to a point when you want a panel inside of a panel. Or a panel that can be used as a block. That is exactly what mini-panels does. You can create a small panel here with various pieces of content and then put it inside of a panels-page or panels-node.') .'</p>'; 00020 $output .= '<p><b>'. t('Views panes') .'</b>'. t(" expose views so they may be added to panels. Panels will automatically detect block views without this module; however, page and embedded views will <strong>not be</strong> selectable from Panels by default. If you enable the <strong>Views panes</strong> module, you may expose individual views to Panels. The <strong>Legacy views panes</strong> module will simply expose all views, so that you may add them in any panel. Both modules provide options for customization of the views' settings on a per-Panel basis. This is useful if you have multiple administrators or want to use panels for something other than just panel pages.") .'</p>'; 00021 $output .= '<p>' . t('If you do not see the above items in the list below, you may need to activate them on the <a href="!url">module administration</a> page.', array('!url' => url('admin/build/modules'))) . '</p>'; 00022 00023 return $output; 00024 } 00025 }
| panels_imagebutton_value | ( | ) |
| panels_load_include | ( | $ | include, | |
| $ | path = 'includes/' | |||
| ) |
Load a panels include file.
Definition at line 140 of file panels.module.
References panels_get_path().
Referenced by _panels_edit_layout(), panels_allowed_layouts::list_layouts(), panels_ajax_passthru(), panels_common_get_allowed_types(), panels_common_get_layout_information(), panels_common_settings(), panels_edit(), panels_edit_layout(), panels_edit_layout_settings(), panels_mini_add_page(), panels_mini_block(), panels_mini_content(), panels_mini_context_form(), panels_mini_edit_content(), panels_mini_edit_form(), panels_mini_list_page(), panels_mini_preview_panel(), panels_mini_settings(), panels_node_add(), panels_node_context_edit(), panels_node_context_form(), panels_node_edit_content(), panels_node_edit_layout(), panels_node_edit_layout_settings(), panels_node_form(), panels_node_settings(), panels_node_view(), panels_page_context_form(), panels_page_edit_content(), panels_page_edit_form(), panels_page_menu(), panels_page_passthru(), panels_page_settings(), panels_page_view_page(), panels_print_layout(), panels_render_display(), panels_save_display(), panels_update_5209(), and panels_views_edit_view_form().
00140 { 00141 require_once './' . panels_get_path("$path$include.inc"); 00142 }
| panels_menu | ( | $ | may_cache | ) |
Implementation of hook_menu
Definition at line 39 of file panels.module.
References panels_get_path().
00039 { 00040 if ($may_cache) { 00041 $items[] = array( 00042 'path' => 'admin/panels', 00043 'title' => t('Panels'), 00044 'access' => user_access('access administration pages'), 00045 'callback' => 'system_admin_menu_block_page', 00046 'description' => t('Administer items related to the Panels module.'), 00047 ); 00048 $items[] = array( 00049 'path' => 'panels/node/autocomplete', 00050 'title' => t('Autocomplete node'), 00051 'callback' => 'panels_node_autocomplete', 00052 'access' => user_access('access content'), 00053 'type' => MENU_CALLBACK, 00054 ); 00055 // TODO Deprecated generalized ajax handler. Remove if at all possible. 00056 $items[] = array( 00057 'path' => 'panels/ajax', 00058 'title' => t('ajax'), 00059 'callback' => 'panels_ajax_passthru', 00060 'callback arguments' => array('panels_ajax'), 00061 'access' => user_access('access content'), 00062 'type' => MENU_CALLBACK, 00063 ); 00064 $items[] = array( 00065 'path' => 'panels/common/ajax', 00066 'title' => t('ajax'), 00067 'callback' => 'panels_ajax_passthru', 00068 'callback arguments' => array('panels_common_ajax'), 00069 'access' => user_access('access content'), 00070 'type' => MENU_CALLBACK, 00071 ); 00072 $items[] = array( 00073 'path' => 'panels/ajax/add-content', 00074 'title' => t('ajax'), 00075 'callback' => 'panels_ajax_passthru', 00076 'callback arguments' => array('panels_ajax_add_content'), 00077 'access' => user_access('access content'), 00078 'type' => MENU_CALLBACK, 00079 ); 00080 $items[] = array( 00081 'path' => 'panels/ajax/add-config', 00082 'title' => t('ajax'), 00083 'callback' => 'panels_ajax_passthru', 00084 'callback arguments' => array('panels_ajax_add_config'), 00085 'access' => user_access('access content'), 00086 'type' => MENU_CALLBACK, 00087 ); 00088 $items[] = array( 00089 'path' => 'panels/ajax/configure', 00090 'title' => t('ajax'), 00091 'callback' => 'panels_ajax_passthru', 00092 'callback arguments' => array('panels_ajax_configure'), 00093 'access' => user_access('access content'), 00094 'type' => MENU_CALLBACK, 00095 ); 00096 $items[] = array( 00097 'path' => 'panels/ajax/toggle-shown', 00098 'title' => t('ajax'), 00099 'callback' => 'panels_ajax_passthru', 00100 'callback arguments' => array('panels_ajax_toggle_shown'), 00101 'access' => user_access('access content'), 00102 'type' => MENU_CALLBACK, 00103 ); 00104 $items[] = array( 00105 'path' => 'panels/ajax/cache', 00106 'title' => t('ajax'), 00107 'callback' => 'panels_ajax_passthru', 00108 'callback arguments' => array('panels_ajax_cache'), 00109 'access' => user_access('access content'), 00110 'type' => MENU_CALLBACK, 00111 ); 00112 $items[] = array( 00113 'path' => 'panels/ajax/cache-settings', 00114 'title' => t('ajax'), 00115 'callback' => 'panels_ajax_passthru', 00116 'callback arguments' => array('panels_ajax_cache_settings'), 00117 'access' => user_access('access content'), 00118 'type' => MENU_CALLBACK, 00119 ); 00120 $items[] = array( 00121 'path' => 'panels/ajax/panel_settings', 00122 'title' => t('ajax'), 00123 'callback' => 'panels_ajax_passthru', 00124 'callback arguments' => array('panels_panel_settings_ajax'), 00125 'access' => user_access('access content'), 00126 'type' => MENU_CALLBACK, 00127 ); 00128 } 00129 else { 00130 drupal_add_css(panels_get_path('css/panels.css')); 00131 drupal_add_js(panels_get_path('js/panels.js')); 00132 } 00133 00134 return $items; 00135 }
| panels_nid_autocomplete | ( | $ | int | ) |
Helper function for parsing an autocomplete node field.
| $string | A string in autocomplete syntax (e.g. ".... [nid: 123]"), or a typed-in nid, or a node title. |
Definition at line 1313 of file panels.module.
Referenced by panels_context_node_edit_form_settings_form_validate(), panels_context_node_settings_form_validate(), and panels_node_legacy_edit_validate().
01313 { 01314 $nid = NULL; 01315 if (is_numeric($int)) { 01316 // The user typed a NID outright. 01317 $nid = $int; 01318 } 01319 else { 01320 // Else, it might be an autocomplete syntax. 01321 $preg_matches = array(); 01322 $match = preg_match('/\[nid: (\d+)\]/', $int, $preg_matches) 01323 || preg_match('/^nid: (\d+)/', $int, $preg_matches); 01324 if ($match) { 01325 $nid = $preg_matches[1]; 01326 } 01327 } 01328 if (isset($nid)) { 01329 // Verify that node exists and we have access to it. 01330 $node = db_fetch_object(db_query(db_rewrite_sql("SELECT n.nid FROM {node} n WHERE n.nid = %d"), $nid)); 01331 } 01332 else { 01333 // Try to find a node having that title. 01334 $node = db_fetch_object(db_query(db_rewrite_sql("SELECT n.nid FROM {node} n WHERE LOWER(n.title) = LOWER('%s')"), $int)); 01335 } 01336 if ($node) { 01337 return $node->nid; 01338 } 01339 }
| panels_node_autocomplete | ( | $ | string | ) |
Helper function for autocompletion of node titles. This is mostly stolen from clipper.
Definition at line 1344 of file panels.module.
01344 { 01345 // TODO: Compare this to the nodequeue version, see which is better. 01346 // TODO: The nodequeue version is totally better. Steal it. 01347 // if there are node_types passed, we'll use those in a MySQL IN query. 01348 if ($string != '') { 01349 $preg_matches = array(); 01350 $match = preg_match('/\[nid: (\d+)\]/', $string, $preg_matches); 01351 if (!$match) { 01352 $match = preg_match('/^nid: (\d+)/', $string, $preg_matches); 01353 } 01354 if ($match) { 01355 $arg = $preg_matches[1]; 01356 $where = "n.nid = %d"; 01357 } 01358 else { 01359 $arg = $string; 01360 $where = "LOWER(title) LIKE LOWER('%%%s%%')"; 01361 } 01362 $result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, u.name FROM {node} n INNER JOIN {users} u ON u.uid = n.uid WHERE $where"), $arg, 0, 10); 01363 01364 $matches = array(); 01365 while ($node = db_fetch_object($result)) { 01366 $name = empty($node->name) ? variable_get('anonymous', t('Anonymous')) : check_plain($node->name); 01367 $matches[$node->title . " [nid: $node->nid]"] = '<span class="autocomplete_title">'. check_plain($node->title) .'</span> <span class="autocomplete_user">('. t('by @user', array('@user' => $name)) .')</span>'; 01368 } 01369 drupal_set_header('Content-Type: text/javascript; charset=utf-8'); 01370 print drupal_to_js($matches); 01371 } 01372 }
| panels_node_type | ( | $ | op, | |
| $ | info | |||
| ) |
Implementation of hook_node_type().
We implement this hook to update any pane contexts that are reliant on a specific node type with the new type name.
Definition at line 1380 of file panels.module.
01380 { 01381 if ($op == 'update') { 01382 if (!empty($info->old_type) && $info->old_type != $info->type) { 01383 // Exclude a few common pane types that we know don't use context. 01384 $result = db_query("SELECT * FROM {panels_pane} WHERE type NOT IN ('block', 'custom')"); 01385 while ($pane = db_fetch_object($result)) { 01386 // Check the serialized data for the presence of context data. 01387 if (!preg_match('/s:7:\"context/', $pane->configuration) || stripos($pane->configuration, 'node-' . $info->old_type) === FALSE) { 01388 // There's no context/no mention of our node type - next! 01389 continue; 01390 } 01391 $conf = unserialize($pane->configuration); 01392 // Manage panes with multiple contexts stored in an array. 01393 if (is_array($conf['context'] && ($keys = array_keys($conf['context'], 'node-' . $info->old_type)))) { 01394 foreach ($keys as $key) { 01395 $conf['context'][$key] = 'node-' . $info->type; 01396 } 01397 db_query("UPDATE {panels_pane} SET configuration = '%s' WHERE pid = %d", serialize($conf), $pane->pid); 01398 } 01399 // Manage single-context panes. 01400 else if ($conf['context'] == 'node-' . $info->old_type) { 01401 $conf['context'] = 'node-' . $info->type; 01402 db_query("UPDATE {panels_pane} SET configuration = '%s' WHERE pid = %d", serialize($conf), $pane->pid); 01403 } 01404 } 01405 } 01406 } 01407 }
| panels_perm | ( | ) |
Implementation of hook_perm
Definition at line 241 of file panels.module.
00241 { 00242 return array('view all panes', 'view pane admin links', 'administer pane visibility', 'administer pane access', 'administer advanced pane settings', 'use panels caching features'); 00243 }
| panels_print_layout | ( | $ | id, | |
| $ | content | |||
| ) |
For external use: Given a layout ID and a $content array, return the panel display. The content array is filled in based upon the content available in the layout. If it's a two column with a content array defined like array('left' => t('Left side'), 'right' => t('Right side')), then the $content array should be array('left' => $output_left, 'right' => $output_right)
Definition at line 949 of file panels.module.
References panels_get_layout(), panels_load_include(), and panels_render_layout().
00949 { 00950 panels_load_include('plugins'); 00951 $layout = panels_get_layout($id); 00952 if (!$layout) { 00953 return; 00954 } 00955 00956 return panels_render_layout($layout, $content); 00957 }
| panels_print_layout_icon | ( | $ | id, | |
| $ | layout, | |||
| $ | title = NULL | |||
| ) |
Definition at line 1212 of file panels.module.
References panels_get_path().
Referenced by panels_change_layout(), panels_choose_layout(), panels_common_get_layout_information(), panels_common_set_allowed_layouts(), panels_mini_edit_form(), and panels_page_edit_form().
01212 { 01213 drupal_add_css(panels_get_path('css/panels_admin.css')); 01214 $file = panels_get_path($layout['icon'], false, $layout['module']); 01215 return theme('panels_layout_icon', $id, theme('image', $file), $title); 01216 }
| panels_print_layout_link | ( | $ | id, | |
| $ | layout, | |||
| $ | link | |||
| ) |
Print the layout link. Sends out to a theme function.
Definition at line 1203 of file panels.module.
References panels_get_path().
Referenced by panels_mini_add_page(), panels_node_add(), and panels_page_add_page().
01203 { 01204 drupal_add_css(panels_get_path('css/panels_admin.css')); 01205 $file = panels_get_path($layout['icon'], false, $layout['module']); 01206 $image = l(theme('image', $file), $link, NULL, NULL, NULL, NULL, TRUE); 01207 $title = l($layout['title'], $link); 01208 return theme('panels_layout_link', $title, $id, $image, $link); 01209 }
| panels_render_layout | ( | $ | layout, | |
| $ | content, | |||
| $ | css_id = NULL, |
|||
| $ | settings = array() | |||
| ) |
Given a full layout structure and a content array, render a panel display.
Definition at line 963 of file panels.module.
References panels_get_cached_content(), panels_get_path(), panels_render_panes(), and panels_set_cached_content().
Referenced by panels_print_layout(), panels_render_display(), and theme_panels_edit_display().
00963 { 00964 if (!empty($layout['css'])) { 00965 if (file_exists(path_to_theme() . '/' . $layout['css'])) { 00966 drupal_add_css(path_to_theme() . '/' . $layout['css']); 00967 } 00968 else { 00969 drupal_add_css(panels_get_path($layout['css'], false, $layout['module'])); 00970 } 00971 } 00972 $display = NULL; 00973 00974 // This now comes after the CSS is added, because panels-within-panels must 00975 // have their CSS added in the right order; inner content before outer content. 00976 00977 // If $content is an object, it's a $display and we have to render its panes. 00978 if (is_object($content)) { 00979 $display = $content; 00980 if (empty($display->cache['method'])) { 00981 $content = panels_render_panes($display); 00982 } 00983 else { 00984 $cache = panels_get_cached_content($display, $display->args, $display->context); 00985 if ($cache === FALSE) { 00986 $cache = new panels_cache_object(); 00987 $cache->set_content(panels_render_panes($display)); 00988 panels_set_cached_content($cache, $display, $display->args, $display->context); 00989 } 00990 $content = $cache->content; 00991 } 00992 } 00993 00994 $output = theme($layout['theme'], check_plain($css_id), $content, $settings, $display); 00995 00996 return $output; 00997 }
| panels_render_pane | ( | $ | content, | |
| $ | pane, | |||
| $ | display | |||
| ) |
Render a pane using the appropriate style.
$content The already rendered content via panels_render_pane_content() $pane The $pane information from the display $display The display.
Definition at line 1127 of file panels.module.
References panels_get_style().
Referenced by theme_panels_default_style_render_panel(), theme_panels_list_style_render_panel(), and theme_panels_rounded_corners_style_render_panel().
01127 { 01128 if (!empty($pane->configuration['style'])) { 01129 $style = panels_get_style($pane->configuration['style']); 01130 01131 if (isset($style)) { 01132 $output = theme($style['render pane'], $content, $pane, $display); 01133 01134 // This could be null if no theme function existed. 01135 if (isset($output)) { 01136 return $output; 01137 } 01138 } 01139 } 01140 01141 if (!empty($content)) { 01142 // fallback 01143 return theme('panels_pane', $content, $pane, $display); 01144 } 01145 }
| panels_render_pane_content | ( | &$ | display, | |
| &$ | pane | |||
| ) |
Render a single pane, identifying its context, and put it into the $panes array.
Definition at line 1059 of file panels.module.
References panels_get_pane_content(), and panels_pane_select_context().
Referenced by panels_render_panes().
01059 { 01060 if (empty($pane->context)) { 01061 $pane->context = panels_pane_select_context($pane, $display->context); 01062 if ($pane->context === FALSE) { 01063 return FALSE; 01064 } 01065 } 01066 01067 $content = panels_get_pane_content($display, $pane, $display->args, $pane->context, $display->incoming_content); 01068 01069 $keywords = !empty($display->keywords) ? $display->keywords : array(); 01070 // Override the title if configured to 01071 if (!empty($pane->configuration['override_title'])) { 01072 // Give previous title as an available substitution here. 01073 $keywords['%title'] = $content->title; 01074 $content->title = $pane->configuration['override_title_text']; 01075 } 01076 01077 // Pass long the css_id that is usually available. 01078 if (!empty($pane->configuration['css_id'])) { 01079 $content->css_id = $pane->configuration['css_id']; 01080 } 01081 01082 // Pass long the css_class that is usually available. 01083 if (!empty($pane->configuration['css_class'])) { 01084 $content->css_class = $pane->configuration['css_class']; 01085 } 01086 01087 if (!empty($content->title)) { 01088 // Perform substitutions 01089 if (!empty($keywords)) { 01090 $content->title = strtr($content->title, $keywords); 01091 } 01092 01093 // Sterilize the title 01094 $content->title = filter_xss_admin($content->title); 01095 01096 // If a link is specified, populate. 01097 if (!empty($content->title_link)) { 01098 if (!is_array($content->title_link)) { 01099 $url = array('href' => $content->title_link); 01100 } 01101 else { 01102 $url = $content->title_link; 01103 } 01104 // set defaults so we don't bring up notices 01105 $url += array('href' => '', 'attributes' => NULL, 'query' => NULL, 'fragment' => NULL, 'absolute' => NULL); 01106 $content->title = l($content->title, 01107 $url['href'], 01108 $url['attributes'], 01109 $url['query'], 01110 $url['fragment'], 01111 $url['absolute'], TRUE); 01112 } 01113 } 01114 return $content; 01115 }
| panels_render_panel | ( | $ | display, | |
| $ | panel, | |||
| $ | panes | |||
| ) |
Render a panel, by storing the content of each pane in an appropriate array and then passing through to the theme function that will render the panel in the configured panel style.
| $display | A display object. | |
| $panel | The ID of the panel being rendered | |
| $panes | An array of panes that are assigned to the panel that's being rendered. |
Definition at line 1184 of file panels.module.
References panels_get_panel_style_and_settings().
Referenced by panels_render_panes().
01184 { 01185 list($style, $style_settings) = panels_get_panel_style_and_settings($display->panel_settings, $panel); 01186 01187 // Retrieve the pid (can be a panel page id, a mini panel id, etc.), this 01188 // might be used (or even necessary) for some panel display styles. 01189 // TODO: Got to fix this to use panel page name instead of pid, since pid is 01190 // no longer guaranteed. This needs an API to be able to set the final id. 01191 $owner_id = 0; 01192 if (isset($display->owner) && is_object($display->owner) && isset($display->owner->id)) { 01193 $owner_id = $display->owner->id; 01194 } 01195 01196 return theme($style['render panel'], $display, $owner_id, $panes, $style_settings, $panel); 01197 }
| panels_render_panes | ( | $ | display | ) |
Render all the panes in a display into a $content array to be used by the display theme function.
Definition at line 1003 of file panels.module.
References panels_get_content_type(), panels_pane_access(), panels_render_pane_content(), and panels_render_panel().
Referenced by panels_render_layout().
01003 { 01004 // Safety check. 01005 if (empty($display->content)) { 01006 return array(); 01007 } 01008 01009 // First, render all the panes into little boxes. We do this here because 01010 // some panes request to be rendered after other panes (primarily so they 01011 // can do the leftovers of forms). 01012 $panes = array(); 01013 $later = array(); 01014 01015 foreach ($display->content as $pid => $pane) { 01016 $pane->shown = isset($pane->shown) ? $pane->shown : TRUE; 01017 // TODO Really ought to design a method for creating a quick-access set of content_type (and other plugin) data to help optimize render performance 01018 // If the user can't see this pane, do not render it. 01019 if (!$pane->shown || !panels_pane_access($pane, $display)) { 01020 continue; 01021 } 01022 01023 // If this pane wants to render last, add it to the $later array. 01024 $content_type = panels_get_content_type($pane->type); 01025 01026 if (!empty($content_type['render last'])) { 01027 $later[$pid] = $pane; 01028 continue; 01029 } 01030 01031 $panes[$pid] = panels_render_pane_content($display, $pane); 01032 } 01033 01034 foreach ($later as $pid => $pane) { 01035 $panes[$pid] = panels_render_pane_content($display, $pane); 01036 } 01037 01038 // Loop through all panels, put all panes that belong to the current panel 01039 // in an array, then render the panel. Primarily this ensures that the 01040 // panes are in the proper order. 01041 $content = array(); 01042 foreach ($display->panels as $panel_name => $pids) { 01043 $panel = array(); 01044 foreach ($pids as $pid) { 01045 if (!empty($panes[$pid])) { 01046 $panel[$pid] = $panes[$pid]; 01047 } 01048 } 01049 $content[$panel_name] = panels_render_panel($display, $panel_name, $panel); 01050 } 01051 01052 return $content; 01053 }
| panels_sanitize_display | ( | &$ | display | ) |
Clean up a display and make sure it has some required information if it doesn't already exist. Currently we require a context, an incoming content and a css_id.
Definition at line 615 of file panels.module.
Referenced by panels_render_display().
00615 { 00616 if (!isset($display->args)) { 00617 $display->args = array(); 00618 } 00619 00620 if (!isset($display->incoming_content)) { 00621 $display->incoming_content = NULL; 00622 } 00623 00624 if (!isset($display->context)) { 00625 $display->context = array(); 00626 } 00627 00628 if (!isset($display->css_id)) { 00629 $display->css_id = NULL; 00630 } 00631 }
| panels_set | ( | $ | var, | |
| $ | value = NULL | |||
| ) |
Global storage function, used mostly so that _submit hooks can pass data back to their originator more easily. TODO: deprecated but still in use.
Definition at line 364 of file panels.module.
Referenced by panels_add_content(), and panels_get().
00364 { 00365 static $vars = array(); 00366 if ($value !== NULL) { 00367 $vars[$var] = $value; 00368 } 00369 return $vars[$var]; 00370 }
| panels_var_export | ( | $ | object, | |
| $ | prefix = '' | |||
| ) |
Definition at line 887 of file panels.module.
Referenced by panels_export_display(), panels_export_pane(), panels_mini_export(), panels_page_export(), and panels_views_export().
00887 { 00888 if (is_array($object) && empty($object)) { 00889 $output = 'array()'; 00890 } 00891 else { 00892 $output = var_export($object, TRUE); 00893 } 00894 00895 if ($prefix) { 00896 $output = str_replace("\n", "\n$prefix", $output); 00897 } 00898 return $output; 00899 }
| theme_panels_imagebutton | ( | $ | element | ) |
Theme our image button.
Definition at line 259 of file panels.module.
00259 { 00260 return '<input type="image" ' . 00261 'class="form-' . $element['#button_type'] . ' ' . $element['#class'] . '" ' . 00262 'name="'. $element['#name'] .'" ' . 00263 'value="'. check_plain($element['#default_value']) .'" ' . 00264 'id="' . $element['#id'] . '" ' . 00265 drupal_attributes($element['#attributes']) . 00266 ' src="' . base_path() . $element['#image'] . '" ' . 00267 'alt="' . $element['#title'] . '" ' . 00268 'title="' . $element['#title'] . '" ' . 00269 "/>\n"; 00270 }
| theme_panels_layout_icon | ( | $ | id, | |
| $ | image, | |||
| $ | title = NULL | |||
| ) |
Theme the layout icon image
Definition at line 1234 of file panels.module.
01234 { 01235 $output .= '<span class="layout-icon">'; 01236 $output .= $image; 01237 if ($title) { 01238 $output .= '<span class="caption">' . $title . '</span>'; 01239 } 01240 $output .= '</span>'; 01241 return $output; 01242 }
| theme_panels_layout_link | ( | $ | title, | |
| $ | id, | |||
| $ | image, | |||
| $ | link | |||
| ) |
Theme the layout link image
Definition at line 1222 of file panels.module.
01222 { 01223 $output .= '<div class="layout-link">'; 01224 $output .= $image; 01225 $output .= '<div>' . $title . '</div>'; 01226 $output .= '</div>'; 01227 return $output; 01228 }
| theme_panels_pane | ( | $ | content, | |
| $ | pane, | |||
| $ | display | |||
| ) |
Render a panel pane like a block.
A panel pane can have the following fields:
Definition at line 1262 of file panels.module.
01262 { 01263 if (!empty($content->content)) { 01264 $idstr = $classstr = ''; 01265 if (!empty($content->css_id)) { 01266 $idstr = ' id="' . $content->css_id . '"'; 01267 } 01268 if (!empty($content->css_class)) { 01269 $classstr = ' ' . $content->css_class; 01270 } 01271 01272 $output = "<div class=\"panel-pane$classstr\"$idstr>\n"; 01273 if (user_access('view pane admin links') && !empty($content->admin_links)) { 01274 $output .= "<div class=\"admin-links panel-hide\">" . theme('links', $content->admin_links) . "</div>\n"; 01275 } 01276 if (!empty($content->title)) { 01277 $output .= "<h2 class=\"title\">$content->title</h2>\n"; 01278 } 01279 01280 if (!empty($content->feeds)) { 01281 $output .= "<div class=\"feed\">" . implode(' ', $content->feeds) . "</div>\n"; 01282 } 01283 01284 $output .= "<div class=\"content\">$content->content</div>\n"; 01285 01286 if (!empty($content->links)) { 01287 $output .= "<div class=\"links\">" . theme('links', $content->links) . "</div>\n"; 01288 } 01289 01290 01291 if (!empty($content->more)) { 01292 if (empty($content->more['title'])) { 01293 $content->more['title'] = t('more'); 01294 } 01295 $output .= "<div class=\"more-link\">" . l($content->more['title'], $content->more['href']) . "</div>\n"; 01296 } 01297 01298 $output .= "</div>\n"; 01299 return $output; 01300 } 01301 }
1.5.6