Functions | |
| _panels_ajax_ct_preconfigure (&$cache, &$pane) | |
| panels_add_content ($cache, $panel_id) | |
| panels_ajax_add_config ($did=NULL, $pane_info=NULL) | |
| panels_ajax_add_content ($did=NULL, $panel_id=NULL) | |
| panels_ajax_cache ($did=NULL, $pid=NULL) | |
| panels_ajax_cache_settings ($cache, $pid, $method=NULL) | |
| panels_ajax_configure ($did=NULL, $pid=NULL) | |
| panels_ajax_set_cache_data (&$display, $pid, $method, $settings=array()) | |
| panels_ajax_toggle_shown ($did=NULL, $pid=NULL, $op=NULL) | |
| panels_common_style_settings_form ($did, $style, $style_settings) | |
| panels_content_config_edit_form_submit ($form_values, $cache, $pane) | |
| panels_content_config_form ($cache, $pane, $add=FALSE) | |
| panels_content_config_form_submit ($form_id, $form_values) | |
| panels_edit_cache_method_form ($display, $pid) | |
| panels_edit_cache_method_form_submit ($form_id, $form_values) | |
| panels_edit_cache_settings_form ($display, $pid, $method, $settings_function) | |
| panels_edit_cache_settings_form_submit ($form_id, $form_values) | |
| panels_edit_submit_subform ($display) | |
| panels_panel_settings ($display) | |
| panels_panel_settings_ajax ($did, $panel, $name) | |
| _panels_ajax_ct_preconfigure | ( | &$ | cache, | |
| &$ | pane | |||
| ) |
Helper function for ajax pane type editing callbacks. When needed, preps the cached $display object with relevant data from the content type.
| array | $cache The loaded $cache object containing all the current $display editing data. | |
| object | $pane The $pane object this ajax callback intends to operate on. |
Definition at line 975 of file display_edit.inc.
References panels_get_content_type(), and panels_plugin_get_function().
Referenced by panels_ajax_add_config(), and panels_ajax_configure().
00975 { 00976 $cc = &$cache->content_config[$pane->pid]; 00977 // indicates that the data for this pane has been built for this round of edits and need not be rebuilt 00978 $cc['built'] = TRUE; 00979 $subtype = $cc['ct_data']['subtype'] = $cache->content_types[$pane->type][$pane->subtype]; 00980 $type = $cc['ct_data']['type'] = panels_get_content_type($pane->type); 00981 00982 $cc['ignore_roles'] = !$type['role-based access']; 00983 00984 if (panels_plugin_get_function('content_types', $type, 'visibility control')) { 00985 $cc['visibility_controller'] = $type['visibility control']; 00986 // defaults to NOT using the built-in pane access system if the ct defines a visibility callback 00987 $cc['ignore_roles'] = TRUE; 00988 if (isset($type['roles and visibility']) && $type['roles and visibility'] === TRUE) { 00989 $cc['ignore_roles'] = FALSE; 00990 } 00991 } 00992 00993 if (panels_plugin_get_function('content_types', $type, 'form control')) { 00994 $cc['form_controller'] = $type['form control']; 00995 } 00996 }
| panels_add_content | ( | $ | cache, | |
| $ | panel_id | |||
| ) |
Definition at line 723 of file display_edit.inc.
References panels_get_available_content_types(), panels_get_path(), and panels_set().
Referenced by panels_ajax_add_content().
00723 { 00724 $return = new stdClass(); 00725 $return->type = 'display'; 00726 $return->title = t('Choose type'); 00727 // TODO get rid of this deprecated method 00728 panels_set('return', $return); 00729 00730 if (!isset($cache->content_types)) { 00731 $cache->content_types = panels_get_available_content_types(); 00732 } 00733 00734 $weights = array(t('Contributed modules') => 0); 00735 $categories = array(); 00736 $titles = array(); 00737 00738 foreach ($cache->content_types as $type_name => $subtypes) { 00739 if (is_array($subtypes)) { 00740 foreach ($subtypes as $subtype_name => $subtype_info) { 00741 $title = filter_xss_admin($subtype_info['title']); 00742 $description = isset($subtype_info['description']) ? $subtype_info['description'] : $title; 00743 00744 if (isset($subtype_info['icon'])) { 00745 $icon = $subtype_info['icon']; 00746 $path = isset($subtype_info['path']) ? $subtype_info['path'] : panels_get_path("content_types/$type_name"); 00747 } 00748 else { 00749 $icon = 'no-icon.png'; 00750 $path = panels_get_path('images'); 00751 } 00752 00753 if (isset($subtype_info['category'])) { 00754 if (is_array($subtype_info['category'])) { 00755 list($category, $weight) = $subtype_info['category']; 00756 $weights[$category] = $weight; 00757 } 00758 else { 00759 $category = $subtype_info['category']; 00760 if (!isset($weights['category'])) { 00761 $weights[$category] = 0; 00762 } 00763 } 00764 } 00765 else { 00766 $category = t('Contrib modules'); 00767 } 00768 00769 $output = '<div class="content-type-button clear-block">'; 00770 $link_text = theme('image', $path . '/' . $icon, $description, $description); 00771 $output .= l($link_text, 'javascript: void()', array('class' => 'panels-modal-add-config', 'id' => $type_name . '-' . $panel_id . '-' . $subtype_name), NULL, NULL, NULL, TRUE); 00772 $output .= "<div>" . l($title, 'javascript: void()', array('class' => 'panels-modal-add-config', 'id' => $type_name . '-' . $panel_id . '-' . $subtype_name), NULL, NULL, NULL, TRUE) . "</div>"; 00773 $output .= '</div>'; 00774 if (!isset($categories[$category])) { 00775 $categories[$category] = array(); 00776 $titles[$category] = array(); 00777 } 00778 00779 $categories[$category][] = $output; 00780 $titles[$category][] = $title; 00781 } 00782 } 00783 } 00784 if (!$categories) { 00785 $output = t('There are no content types you may add to this display.'); 00786 } 00787 else { 00788 asort($weights); 00789 $output = ''; 00790 00791 $columns = 3; 00792 foreach (range(1, $columns) as $column) { 00793 $col[$column] = ''; 00794 $size[$column] = 0; 00795 } 00796 00797 foreach ($weights as $category => $weight) { 00798 $which = 1; // default; 00799 $count = count($titles[$category]) + 3; 00800 // Determine which column to use by seeing which column has the most 00801 // free space. This algorithm favors left. 00802 foreach (range($columns, 2) as $column) { 00803 if ($size[$column - 1] - $size[$column] > $count / 2) { 00804 $which = $column; 00805 break; 00806 } 00807 } 00808 00809 $col[$which] .= '<div class="panels-section">'; 00810 $col[$which] .= '<h3 class="panels-section-title">' . $category . '</h3>'; 00811 $col[$which] .= '<div class="panels-section-decorator"></div>'; 00812 $col[$which] .= '<div class="panels-section-content">'; 00813 if (is_array($titles[$category])) { 00814 natcasesort($titles[$category]); 00815 foreach ($titles[$category] as $id => $title) { 00816 $col[$which] .= $categories[$category][$id]; 00817 } 00818 } 00819 $col[$which] .= '</div>'; 00820 $col[$which] .= '</div>'; 00821 $size[$which] += $count; // add 3 to account for title. 00822 } 00823 00824 foreach ($col as $column) { 00825 $output .= '<div class="panels-section-column">' . $column . '</div>'; 00826 } 00827 } 00828 return $output; 00829 }
| panels_ajax_add_config | ( | $ | did = NULL, |
|
| $ | pane_info = NULL | |||
| ) |
Entry point for AJAX: Add pane configuration.
After updating the $cache data and equipping a new $pane object with basic values, the general-purpose ajax form handler, panels_ajax_form(), is called and pushes the configuration form to the screen.
Once form submission is completed, data is pushed back into js by panels_ajax_render().
| int | $did The display id for the display object currently being edited. Errors out silently if absent. | |
| string | $pane_info A string generated by the following code in panels_add_content(): $output .= l($link_text, 'javascript: void()', array('class' => 'panels-modal-add-config', 'id' => $type_name . '-' . $panel_id . '-' . $subtype_name), NULL, NULL, NULL, TRUE); $type_name contains the name of the content type, $panel_id the name of the panel region to which the pane will be added, and $subtype_name is the name of the content subtype. |
Definition at line 890 of file display_edit.inc.
References _panels_ajax_ct_preconfigure(), panels_ajax_form(), panels_ajax_render(), panels_cache_get(), and panels_cache_set().
00890 { 00891 if ((is_numeric($did) || $did == 'new') && $cache = panels_cache_get($did)) { 00892 if (!isset($_POST['form_id'])) { 00893 $pid = $cache->display->next_new_pid(); 00894 $pane = new stdClass(); 00895 $pane->pid = "new-$pid"; 00896 // Ensure there's no data relics. 00897 unset($cache->content_config[$pane->pid], $cache->pane); 00898 $cc = &$cache->content_config[$pane->pid]; 00899 00900 list($cc['content_type'], $cc['panel_id'], $cc['content_subtype']) = explode('-', $pane_info, 3); 00901 list($pane->type, $pane->subtype, $pane->configuration, $pane->access) = array($cc['content_type'], $cc['content_subtype'], array(), array()); 00902 _panels_ajax_ct_preconfigure($cache, $pane); 00903 $cache->pane = drupal_clone($pane); 00904 panels_cache_set($did, $cache); 00905 } 00906 else { 00907 // Not the render passthrough, so the above data has been cached; we retrieve $pane from $cache. 00908 $pane = $cache->pane; 00909 unset($cache->pane); 00910 } 00911 00912 $ajax_vars = panels_ajax_form('panels_content_config_form', 00913 t('Configure !subtype_title', array('!subtype_title' => $cache->content_config[$pane->pid]['ct_data']['subtype']['title'])), 00914 url($_GET['q'], NULL, NULL, TRUE), $cache, $pane, TRUE 00915 ); 00916 panels_ajax_render($ajax_vars); 00917 } 00918 panels_ajax_render(); 00919 }
| panels_ajax_add_content | ( | $ | did = NULL, |
|
| $ | panel_id = NULL | |||
| ) |
Entry point for AJAX: 'Add Content' modal form, from which the user selects the type of pane to add.
| int | $did The display id of the $display object currently being edited. | |
| string | $panel_id A string with the name of the panel region to which the selected pane type will be added. |
Definition at line 704 of file display_edit.inc.
References panels_add_content(), panels_ajax_render(), panels_cache_get(), panels_get_layout(), and panels_get_panels().
00704 { 00705 $output = new stdClass(); 00706 if ((is_numeric($did) || $did == 'new') && $cache = panels_cache_get($did)) { 00707 $display = $cache->display; 00708 $layout = panels_get_layout($display->layout); 00709 $layout_panels = panels_get_panels($layout, $display); 00710 00711 if ($layout && array_key_exists($panel_id, $layout_panels)) { 00712 $output->output = panels_add_content($cache, $panel_id); 00713 $output->type = 'display'; 00714 $output->title = t('Add content to !s', array('!s' => $layout_panels[$panel_id])); 00715 } 00716 } 00717 panels_ajax_render($output); 00718 }
| panels_ajax_cache | ( | $ | did = NULL, |
|
| $ | pid = NULL | |||
| ) |
Entry point for AJAX modal: configure pane
Definition at line 1195 of file display_edit.inc.
References panels_ajax_cache_settings(), panels_ajax_form(), panels_ajax_render(), and panels_cache_get().
01195 { 01196 if (!((is_numeric($did) || $did == 'new') && $cache = panels_cache_get($did))) { 01197 panels_ajax_render(); 01198 } 01199 01200 // First, check to see if this is a form being submitted and, if it is, which 01201 // one, because we can have two forms here. 01202 if (!empty($_POST) && !empty($_POST['form_id']) && $_POST['form_id'] == 'panels_edit_cache_settings_form') { 01203 return panels_ajax_cache_settings($cache, $pid); 01204 } 01205 01206 $method = panels_ajax_form('panels_edit_cache_method_form', 01207 t('Select cache method'), url($_GET['q'], NULL, NULL, TRUE), 01208 $cache->display, $pid 01209 ); 01210 return panels_ajax_cache_settings($cache, $pid, $method); 01211 }
| panels_ajax_cache_settings | ( | $ | cache, | |
| $ | pid, | |||
| $ | method = NULL | |||
| ) |
Handle the cache settings form
Definition at line 1266 of file display_edit.inc.
References panels_ajax_form(), panels_ajax_render(), panels_ajax_set_cache_data(), panels_cache_set(), and panels_plugin_get_function().
Referenced by panels_ajax_cache().
01266 { 01267 if (empty($method) && isset($_POST['method'])) { 01268 // Retrieve the method from the form. 01269 $method = $_POST['method']; 01270 } 01271 01272 if (empty($method) || !($function = panels_plugin_get_function('cache', $method, 'settings form'))) { 01273 panels_ajax_set_cache_data($cache->display, $pid, 0); 01274 } 01275 else { 01276 $cache->display = panels_ajax_form('panels_edit_cache_settings_form', 01277 t('Configure cache settings'), url($_GET['q'], NULL, NULL, TRUE), 01278 $cache->display, $pid, $method, $function 01279 ); 01280 } 01281 01282 panels_cache_set($cache->display->did, $cache); 01283 01284 if ($pid) { 01285 $ajax_vars = new stdClass(); 01286 list($ajax_vars->id, $ajax_vars->output, $ajax_vars->type) = array($pid, 'Changed', 'dismiss-changed'); 01287 panels_ajax_render($ajax_vars); 01288 } 01289 else { 01290 panels_ajax_render('dismiss'); 01291 } 01292 }
| panels_ajax_configure | ( | $ | did = NULL, |
|
| $ | pid = NULL | |||
| ) |
Entry point for AJAX: Edit pane configuration.
Prepares the display $cache and a pre-existing $pane so that the pane configuration form for the $pane can be rendered.
Once form submission is completed, data is pushed back into js by panels_ajax_render().
| int | $did The display id of the display object currently being edited. Errors out silently if absent. | |
| The | pane id of the pane object whose configuration form we're calling up to edit. |
Definition at line 938 of file display_edit.inc.
References _panels_ajax_ct_preconfigure(), panels_ajax_form(), panels_ajax_render(), panels_cache_get(), and panels_cache_set().
00938 { 00939 if ((is_numeric($did) || $did == 'new') && $cache = panels_cache_get($did)) { 00940 if (isset($cache->display->content[$pid]) && $pane = $cache->display->content[$pid]) { 00941 // Only perform on a form rendering passthrough and if the data hasn't already been built. 00942 if (!isset($_POST['form_id']) && empty($cc['built'])) { 00943 $cc = &$cache->content_config[$pane->pid]; 00944 if (!isset($cc)) { 00945 list($cc['content_type'], $cc['content_subtype']) = array($pane->type, $pane->subtype); 00946 _panels_ajax_ct_preconfigure($cache, $pane); 00947 panels_cache_set($did, $cache); 00948 } 00949 } 00950 00951 $ajax_vars = panels_ajax_form('panels_content_config_form', 00952 t('Configure !subtype_title', array('!subtype_title' => $cache->content_config[$pane->pid]['ct_data']['subtype']['title'])), 00953 url($_GET['q'], NULL, NULL, TRUE), $cache, $pane 00954 ); 00955 panels_ajax_render($ajax_vars); 00956 } 00957 } 00958 panels_ajax_render(); 00959 }
| panels_ajax_set_cache_data | ( | &$ | display, | |
| $ | pid, | |||
| $ | method, | |||
| $ | settings = array() | |||
| ) |
Set the cache method and associated settings on the display.
Definition at line 1298 of file display_edit.inc.
Referenced by panels_ajax_cache_settings(), and panels_edit_cache_settings_form_submit().
01298 { 01299 if ($pid) { 01300 $conf = &$display->content[$pid]->cache; 01301 } 01302 else { 01303 $conf = &$display->cache; 01304 } 01305 01306 $conf['method'] = $method; 01307 $conf['settings'] = $settings; 01308 }
| panels_ajax_toggle_shown | ( | $ | did = NULL, |
|
| $ | pid = NULL, |
|||
| $ | op = NULL | |||
| ) |
Entry point for AJAX: toggle pane show/hide status.
| int | $did The display id for the display object currently being edited. Errors out silently if absent. | |
| int | $pid The pane id for the pane object whose show/hide state we're toggling. | |
| string | $op The operation - showing or hiding - that this should perform. This could be calculated from cached values, but given that this is a toggle button and people may click it too fast, it's better to leave the decision on which $op to use up to the js than to calculate it here. |
Definition at line 845 of file display_edit.inc.
References panels_ajax_render(), panels_cache_get(), and panels_cache_set().
00845 { 00846 if ((is_numeric($did) || $did == 'new') && $cache = panels_cache_get($did)) { 00847 $ajax_vars = new stdClass(); 00848 list($ajax_vars->type, $ajax_vars->id, $ajax_vars->old_op) = array('toggle-shown', $pid, drupal_strtolower($op)); 00849 00850 if ($op == 'Show') { 00851 list($cache->display->content[$pid]->shown, $ajax_vars->output, $ajax_vars->new_op) = array(1, 'Hide', 'hide'); 00852 } 00853 elseif ($op == 'Hide') { 00854 list($cache->display->content[$pid]->shown, $ajax_vars->output, $ajax_vars->new_op) = array(0, 'Show', 'show'); 00855 } 00856 else { 00857 // bad args, error out. 00858 panels_ajax_render(); 00859 } 00860 00861 panels_cache_set($cache->display->did, $cache); 00862 panels_ajax_render($ajax_vars); 00863 } 00864 panels_ajax_render(); 00865 }
| panels_common_style_settings_form | ( | $ | did, | |
| $ | style, | |||
| $ | style_settings | |||
| ) |
Form for the style settings modal.
Definition at line 1599 of file display_edit.inc.
01599 { 01600 $form['start_form'] = array('#value' => '<div class="modal-form">'); 01601 $form['description'] = array( 01602 '#prefix' => '<div class="description">', 01603 '#suffix' => '</div>', 01604 '#value' => check_plain($style['description']), 01605 ); 01606 01607 if (isset($style['settings form']) && function_exists($style['settings form'])) { 01608 $form['style_settings'] = $style['settings form']($style_settings); 01609 $form['style_settings']['#tree'] = TRUE; 01610 } 01611 else { 01612 $form['markup'] = array( 01613 '#value' => t('This style does not have any settings.'), 01614 ); 01615 } 01616 $form['end_form'] = array('#value' => '</div>'); 01617 01618 if (!isset($form['markup'])) { 01619 $form['style'] = array( 01620 '#type' => 'value', 01621 '#value' => $style, 01622 ); 01623 01624 $form['did'] = array( 01625 '#type' => 'value', 01626 '#value' => $did, 01627 ); 01628 01629 $form['next'] = array( 01630 '#type' => 'submit', 01631 '#value' => t('Save'), 01632 ); 01633 } 01634 01635 return $form; 01636 }
| panels_content_config_edit_form_submit | ( | $ | form_values, | |
| $ | cache, | |||
| $ | pane | |||
| ) |
Definition at line 1175 of file display_edit.inc.
References _panels_render_preview_pane_disabled().
01175 { 01176 // If this content type defines its own 'editor render callback', we need to 01177 // invoke that again, since we're not doing a full panels_show_pane(). 01178 $content_type = $cache->content_config[$pane->pid]['ct_data']['type']; 01179 if (function_exists($content_type['editor render callback'])) { 01180 $block = $content_type['editor render callback']($cache->display, $pane); 01181 } 01182 else { 01183 $block = _panels_render_preview_pane_disabled($pane, $cache->display->context); 01184 } 01185 $ajax_vars = new stdClass(); 01186 $ajax_vars->type = 'replace'; 01187 $ajax_vars->output = theme('panels_pane_collapsible', $block, $cache->display); 01188 return $ajax_vars; 01189 }
| panels_content_config_form | ( | $ | cache, | |
| $ | pane, | |||
| $ | add = FALSE | |||
| ) |
Master FAPI definition for all pane add/edit configuration forms.
| object | $cache The $cache object for the panels $display currently being edited. | |
| object | $pane The $pane object currently being added/edited. | |
| bool | $add A boolean indicating whether we are adding a new pane ($add === TRUE) operation in this operation, or editing an existing pane ($add === FALSE). |
Definition at line 1015 of file display_edit.inc.
References panels_cache_set(), panels_ct_conf_form(), and panels_ct_pane_config_form().
01015 { 01016 $op = $add ? 'add' : 'edit'; 01017 // for brevity and readability. 01018 $cc = $cache->content_config[$pane->pid]; 01019 01020 $form['start_form'] = array('#value' => '<div class="modal-form">'); 01021 01022 $form['configuration'] = panels_ct_conf_form($cc['ct_data'], $cache->display->context, $pane->configuration); 01023 if (is_array($form_additions = panels_ct_pane_config_form($pane, $cache->display->context, array('configuration'), $op))) { 01024 $form['configuration'] += $form_additions; 01025 } 01026 $form['configuration']['#tree'] = TRUE; 01027 01028 if (!$cc['ignore_roles']) { 01029 if (user_access('administer pane access')) { 01030 $rids = array(); 01031 $result = db_query("SELECT r.rid, r.name FROM {role} r ORDER BY r.name"); 01032 while ($obj = db_fetch_object($result)) { 01033 $rids[$obj->rid] = $obj->name; 01034 } 01035 01036 $form['access'] = array( 01037 '#type' => 'checkboxes', 01038 '#title' => t('Access'), 01039 '#default_value' => $add ? array() : $pane->access, 01040 '#options' => $rids, 01041 '#description' => t('Only the checked roles will be able to see this pane; if no roles are checked, access will not be restricted.'), 01042 ); 01043 } 01044 else { 01045 $form['access'] = array( 01046 '#type' => 'value', 01047 '#value' => isset($pane->access) ? $pane->access : array(), 01048 ); 01049 } 01050 } 01051 01052 if (isset($cc['visibility_controller'])) { 01053 $form['visibility'] = $cc['visibility_controller']($cache->display->context, $pane->subtype, $pane->configuration, $add); 01054 } 01055 01056 $form['end_form'] = array('#value' => '</div>'); 01057 01058 $form['next'] = array( 01059 '#type' => 'submit', 01060 '#value' => $add ? t('Add pane') : t('Save'), 01061 ); 01062 01063 $form['vars'] = array('#type' => 'value', '#value' => array($cache, $pane, $add, $op)); 01064 01065 // Allows content types that define this callback to have full control over the pane config form. 01066 if (isset($cc['form_controller'])) { 01067 call_user_func_array($cc['form_controller'], array(&$form, &$cache->content_config[$pane->pid], &$cache->display, $add)); 01068 // Only set the cache with any new vars on the render passthrough; setting 01069 // it again could, depending on the changes in the plugin function, cause 01070 // serious data consistency problems. 01071 if (!isset($_POST['form_id'])) { 01072 panels_cache_set($cache->display->did, $cache); 01073 } 01074 } 01075 return $form; 01076 }
| panels_content_config_form_submit | ( | $ | form_id, | |
| $ | form_values | |||
| ) |
FAPI submit handler for panels_content_config_form().
Call any submit handlers defined by the content type, update the $cache object with the relevant data, save $cache to the object_cache table, and return data for ajax updates.
Definition at line 1102 of file display_edit.inc.
References panels_cache_set(), panels_ct_pane_submit_form(), and panels_plugin_get_function().
01102 { 01103 list($cache, $pane, $add, $op) = $form_values['vars']; 01104 // Start by saving all initial $pane values into the array of pane data in $display->content. 01105 $cache->display->content[$pane->pid] = $pane; 01106 // Call the submit handler provided by the pane type, if any. 01107 panels_ct_pane_submit_form($pane->type, $form_values['configuration'], $op); 01108 01109 if (isset($form_values['visibility'])) { 01110 if ($visibility_submit = panels_plugin_get_function('content_types', $cache->content_config[$pane->pid]['ct_data']['type'], 'visibility submit')) { 01111 // Use call_user_func_array() in order to ensure that all these values can only be passed by value. 01112 $cache->display->content[$pane->pid]->visibility = call_user_func_array($visibility_submit, 01113 array($form_values['visibility'], $add, $cache->display->content[$pane->pid], $cache->display)); 01114 } 01115 else { 01116 // If no visibility submit callback is defined, fall back to the default storage behavior. Should be 01117 // adequate for the vast majority of use cases, so most client modules won't need to define callbacks. 01118 $cache->display->content[$pane->pid]->visibility = is_array($form_values['visibility']) ? array_keys(array_filter($form_values['visibility'])) : $form_values['visibility']; 01119 } 01120 } 01121 else { 01122 $cache->display->content[$pane->pid]->visibility = ''; 01123 } 01124 01125 if (isset($form_values['access'])) { 01126 $cache->display->content[$pane->pid]->access = array_keys(array_filter($form_values['access'])); 01127 } 01128 else { 01129 $cache->display->content[$pane->pid]->access = array(); 01130 } 01131 01132 $cache->display->content[$pane->pid]->configuration = $form_values['configuration']; 01133 01134 // Call submit handlers specific to the $op ('add' or 'edit'). 01135 $ajax_vars = call_user_func_array("panels_content_config_" . $op . "_form_submit", array($form_values, &$cache, $pane)); 01136 $ajax_vars->id = $pane->pid; 01137 panels_cache_set($cache->display->did, $cache); 01138 return $ajax_vars; 01139 }
| panels_edit_cache_method_form | ( | $ | display, | |
| $ | pid | |||
| ) |
Choose cache method form
Definition at line 1217 of file display_edit.inc.
References panels_get_caches().
01217 { 01218 $conf = $pid ? $display->content[$pid]->cache : $display->cache; 01219 01220 // Set to 0 to ensure we get a selected radio. 01221 if (!isset($conf['method'])) { 01222 $conf['method'] = 0; 01223 } 01224 01225 $caches = panels_get_caches(); 01226 if (empty($caches)) { 01227 $form['markup'] = array('#value' => t('No caching options are available at this time. Please enable a panels caching module in order to use caching options.')); 01228 return $form; 01229 } 01230 01231 $options[0] = t('No caching'); 01232 foreach ($caches as $cache => $info) { 01233 $options[$cache] = check_plain($info['title']); 01234 } 01235 01236 $form['method'] = array( 01237 '#prefix' => '<div class="no-float">', 01238 '#suffix' => '</div>', 01239 '#type' => 'radios', 01240 '#title' => t('Method'), 01241 '#options' => $options, 01242 '#default_value' => $conf['method'], 01243 ); 01244 01245 $form['submit'] = array( 01246 '#type' => 'submit', 01247 '#value' => t('Next'), 01248 ); 01249 return $form; 01250 }
| panels_edit_cache_method_form_submit | ( | $ | form_id, | |
| $ | form_values | |||
| ) |
Submit callback for panels_edit_cache_method_form.
All this needs to do is return the method.
Definition at line 1258 of file display_edit.inc.
| panels_edit_cache_settings_form | ( | $ | display, | |
| $ | pid, | |||
| $ | method, | |||
| $ | settings_function | |||
| ) |
Cache settings form
Definition at line 1314 of file display_edit.inc.
References panels_get_cache().
01314 { 01315 $conf = $pid ? $display->content[$pid]->cache : $display->cache; 01316 $info = panels_get_cache($method); 01317 01318 $form['description'] = array( 01319 '#prefix' => '<div class="description">', 01320 '#suffix' => '</div>', 01321 '#value' => check_plain($info['description']), 01322 ); 01323 $form['settings'] = $settings_function($conf['settings'], $display, $pid); 01324 $form['settings']['#tree'] = TRUE; 01325 01326 $form['method'] = array( 01327 '#type' => 'hidden', 01328 '#value' => $method, 01329 ); 01330 01331 $form['display'] = array( 01332 '#type' => 'value', 01333 '#value' => $display, 01334 ); 01335 01336 $form['pid'] = array( 01337 '#type' => 'value', 01338 '#value' => $pid, 01339 ); 01340 01341 $form['submit'] = array( 01342 '#type' => 'submit', 01343 '#value' => t('Save'), 01344 ); 01345 return $form; 01346 }
| panels_edit_cache_settings_form_submit | ( | $ | form_id, | |
| $ | form_values | |||
| ) |
Allows panel styles to validate their style settings.
Definition at line 1361 of file display_edit.inc.
References panels_ajax_set_cache_data(), and panels_plugin_get_function().
01361 { 01362 if ($function = panels_plugin_get_function('cache', $form_values['method'], 'settings form submit')) { 01363 $function($form_values['settings']); 01364 } 01365 01366 // Identify which configuration we're setting 01367 $pid = $form_values['pid']; 01368 $display = $form_values['display']; 01369 01370 panels_ajax_set_cache_data($display, $pid, $form_values['method'], $form_values['settings']); 01371 return $display; 01372 }
| panels_edit_submit_subform | ( | $ | display | ) |
Definition at line 1377 of file display_edit.inc.
References panels_ajax_render(), and panels_get().
Referenced by panels_ajax().
01377 { 01378 // Check forms to make sure only valid forms can be rendered this way. 01379 $valid_forms = array('panels_add_content_config_form', 'panels_edit_pane_config_form'); 01380 $form_id = $_POST['form_id']; 01381 if (!in_array($form_id, $valid_forms)) { 01382 return panels_ajax_render(); 01383 } 01384 01385 $output = drupal_get_form($form_id, $display); 01386 01387 $next = panels_get('next'); 01388 01389 if ($next) { 01390 $output = drupal_get_form($next['form'], $display, $next['data']); 01391 $return = panels_get('return'); 01392 if (!$return->output) { 01393 $return->output = $output; 01394 } 01395 } 01396 else { 01397 if (!($return = panels_get('return'))) { 01398 $return->type = 'display'; 01399 $return->output = $output; 01400 } 01401 else if ($return->type == 'display' && !$return->output) { 01402 $return->output = $output; 01403 } 01404 } 01405 01406 if ($return->type == 'display') { 01407 $return->output = theme('status_messages') . $return->output; 01408 } 01409 return $return; 01410 }
| panels_panel_settings | ( | $ | display | ) |
Form to edit panel style settings.
Definition at line 1419 of file display_edit.inc.
References panels_common_cache_get(), panels_common_cache_set(), panels_get_layout(), panels_get_panels(), panels_get_path(), panels_get_style(), and panels_get_styles().
Referenced by panels_edit_layout_settings_form().
01419 { 01420 $panel_settings = $display->panel_settings; 01421 $style = panels_get_style((!empty($panel_settings['style'])) ? $panel_settings['style'] : 'default'); 01422 01423 // Let the user choose between panel styles that are available for any 01424 // panels implementation or specifically to this one. 01425 $options = array(); 01426 foreach (panels_get_styles() as $name => $properties) { 01427 if (empty($properties['hidden']) && (!empty($properties['render panel']))) { 01428 $options[$name] = $properties['title']; 01429 } 01430 } 01431 01432 $form = array(); 01433 01434 $form['display'] = array('#type' => 'value', '#value' => $display); 01435 01436 $form['panel_settings'] = array( 01437 '#type' => 'fieldset', 01438 '#title' => t('Panel settings'), 01439 '#tree' => TRUE, 01440 ); 01441 01442 $form['panel_settings']['start_box'] = array( 01443 '#value' => '<div class="form-item clear-block"><label>' . t('Default panel style') . ':</label>', 01444 ); 01445 01446 $modals = array(); 01447 $form['panel_settings']['style'] = array( 01448 '#prefix' => '<div class="panels-style-settings-box">', 01449 '#suffix' => '</div>', 01450 '#type' => 'select', 01451 '#options' => $options, 01452 '#id' => 'panel-settings-style', 01453 '#default_value' => $style['name'], 01454 ); 01455 01456 // Is this form being posted? If so, check cache. 01457 if (!empty($_POST)) { 01458 $style_settings = panels_common_cache_get('style_settings', $display->did); 01459 } 01460 if (!isset($style_settings)) { 01461 $style_settings = !empty($panel_settings['style_settings']) ? $panel_settings['style_settings'] : array(); 01462 panels_common_cache_set('style_settings', $display->did, $style_settings); 01463 } 01464 01465 $form['panel_settings']['style_settings'] = array( 01466 '#type' => 'value', 01467 '#value' => $style_settings, 01468 ); 01469 $form['panel_settings']['edit_style'] = array( 01470 '#type' => 'submit', 01471 '#id' => 'panels-style-settings', 01472 '#value' => t('Edit style settings'), 01473 ); 01474 01475 // Set up the AJAX settings for the modal. 01476 $modals['#panels-style-settings'] = array(url('panels/ajax/panel_settings/' . $display->did . '/default', NULL, NULL, TRUE), '#panel-settings-style'); 01477 01478 $form['panel_settings']['end_box'] = array( 01479 '#value' => '</div>', 01480 ); 01481 01482 $form['panel_settings']['individual'] = array( 01483 '#type' => 'checkbox', 01484 '#title' => t('Per panel settings'), 01485 '#id' => 'panel-settings-individual', 01486 '#description' => t('If this is checked, each region in the display can have its own style.'), 01487 '#default_value' => $panel_settings['individual'], 01488 ); 01489 01490 $layout_options = array_merge(array('-1' => t('Use the default panel style')), $options); 01491 $layout = panels_get_layout($display->layout); 01492 $layout_panels = panels_get_panels($layout, $display); 01493 01494 $checkboxes = array(); 01495 foreach ($layout_panels as $id => $name) { 01496 $form['panel_settings']['panel'][$id]['start_box'] = array( 01497 '#value' => '<div class="form-item clear-block"><label>' . $name . ':</label>', 01498 ); 01499 $form['panel_settings']['panel'][$id]['style'] = array( 01500 '#prefix' => '<div class="panels-style-settings-box">', 01501 '#suffix' => '</div>', 01502 '#type' => 'select', 01503 '#options' => $layout_options, 01504 '#id' => 'panel-settings-style-' . $id, 01505 '#default_value' => $display->panel_settings['panel'][$id]['style'], 01506 ); 01507 $checkboxes[] = '#panel-settings-style-' . $id; 01508 01509 $form['panel_settings']['panel'][$id]['edit_style'] = array( 01510 '#type' => 'submit', 01511 '#id' => 'panels-style-settings-' . $id, 01512 '#attributes' => array('class' => 'panels-style-settings'), 01513 '#value' => t('Edit style settings'), 01514 ); 01515 $checkboxes[] = '#panels-style-settings-' . $id; 01516 01517 // Set up the AJAX settings for the modal. 01518 $modals['#panels-style-settings-' . $id ] = array(url('panels/ajax/panel_settings/' . $display->did . '/' . $id, NULL, NULL, TRUE), '#panel-settings-style-' . $id); 01519 01520 $form['panel_settings']['panel'][$id]['end_box'] = array( 01521 '#value' => '</div>', 01522 ); 01523 } 01524 01525 // while we don't use this directly some of our forms do. 01526 drupal_add_js('misc/collapse.js'); 01527 drupal_add_js('misc/autocomplete.js'); 01528 01529 $ajax = array('panels' => array( 01530 'closeText' => t('Close Window'), 01531 'closeImage' => theme('image', panels_get_path('images/icon-delete.png'), t('Close window'), t('Close window')), 01532 'throbber' => theme('image', panels_get_path('images/throbber.gif'), t('Loading...'), t('Loading')), 01533 'checkboxes' => array('#panel-settings-individual' => $checkboxes), 01534 'modals' => $modals, 01535 )); 01536 01537 $form['panel_settings']['did'] = array( 01538 '#type' => 'value', 01539 '#value' => $display->did, 01540 ); 01541 01542 drupal_add_js(panels_get_path('js/lib/dimensions.js')); 01543 drupal_add_js(panels_get_path('js/lib/mc.js')); 01544 drupal_add_js(panels_get_path('js/lib/form.js')); 01545 drupal_add_js($ajax, 'setting'); 01546 drupal_add_js(panels_get_path('js/checkboxes.js')); 01547 drupal_add_js(panels_get_path('js/modal_forms.js')); 01548 drupal_add_css(panels_get_path('css/panels_dnd.css')); 01549 01550 return $form; 01551 }
| panels_panel_settings_ajax | ( | $ | did, | |
| $ | panel, | |||
| $ | name | |||
| ) |
AJAX incoming to deal with the style settings modal
Definition at line 1571 of file display_edit.inc.
References panels_ajax_form(), panels_ajax_render(), panels_common_cache_get(), panels_common_cache_set(), and panels_get_style().
01571 { 01572 if ($name == '0') { 01573 panels_ajax_render(t('There are no style settings to edit.'), t('Edit default style settings')); 01574 } 01575 01576 $style = panels_get_style($name); 01577 $style_settings = panels_common_cache_get('style_settings', $did); 01578 if (!isset($style_settings)) { 01579 panels_ajax_render(); 01580 } 01581 01582 // Render the panels ajax form. This only returns to us on successful 01583 // submit; otherwise the form is rendered for us and nothing else happens. 01584 $style_settings[$panel] = panels_ajax_form('panels_common_style_settings_form', 01585 t('Edit style settings for @style', array('@style' => $style['title'])), 01586 url($_GET['q'], NULL, NULL, TRUE), 01587 $did, $style, $style_settings[$panel] 01588 ); 01589 01590 panels_common_cache_set('style_settings', $did, $style_settings); 01591 panels_ajax_render('dismiss'); 01592 }
1.5.6