function add_meta() { ctools_include('display-edit', 'panels'); ctools_include('content'); if (empty($this->display->cache_key)) { $this->cache = panels_edit_cache_get_default($this->display); } // @todo we may need an else to load the cache, but I am not sure we // actually need to load it if we already have our cache key, and doing // so is a waste of resources. ctools_include('cleanstring'); $this->clean_key = ctools_cleanstring($this->display->cache_key); panels_ipe_get_cache_key($this->clean_key); ctools_include('ajax'); ctools_include('modal'); ctools_modal_add_js(); ctools_add_css('panels_dnd', 'panels'); ctools_add_css('panels_admin', 'panels'); ctools_add_js('panels_ipe', 'panels_ipe'); ctools_add_css('panels_ipe', 'panels_ipe'); $settings = array('formPath' => url($this->get_url('save-form'))); drupal_add_js(array('PanelsIPECacheKeys' => array($this->clean_key)), 'setting'); drupal_add_js(array('PanelsIPESettings' => array($this->clean_key => $settings)), 'setting'); jquery_ui_add(array('ui.draggable', 'ui.droppable', 'ui.sortable')); parent::add_meta(); }
function add_meta() { ctools_include('display-edit', 'panels'); ctools_include('content'); if (empty($this->display->cache_key)) { $this->cache = panels_edit_cache_get_default($this->display); } // @todo we may need an else to load the cache, but I am not sure we // actually need to load it if we already have our cache key, and doing // so is a waste of resources. ctools_include('cleanstring'); $this->clean_key = ctools_cleanstring($this->display->cache_key); $button = array('#type' => 'link', '#title' => t('Customize this page'), '#href' => $this->get_url('save_form'), '#id' => 'panels-ipe-customize-page', '#attributes' => array('class' => array('panels-ipe-startedit', 'panels-ipe-pseudobutton')), '#ajax' => array('progress' => 'throbber', 'ipe_cache_key' => $this->clean_key), '#prefix' => '<div class="panels-ipe-pseudobutton-container">', '#suffix' => '</div>'); panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-startedit', $button); // @todo this actually should be an IPE setting instead. if (user_access('change layouts in place editing')) { $button = array('#type' => 'link', '#title' => t('Change layout'), '#href' => $this->get_url('change_layout'), '#attributes' => array('class' => array('panels-ipe-change-layout', 'panels-ipe-pseudobutton', 'ctools-modal-layout')), '#ajax' => array('progress' => 'throbber', 'ipe_cache_key' => $this->clean_key), '#prefix' => '<div class="panels-ipe-pseudobutton-container">', '#suffix' => '</div>'); panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-change-layout', $button); } ctools_include('ajax'); ctools_include('modal'); ctools_modal_add_js(); ctools_add_css('panels_dnd', 'panels'); ctools_add_css('panels_admin', 'panels'); ctools_add_js('panels_ipe', 'panels_ipe'); ctools_add_css('panels_ipe', 'panels_ipe'); drupal_add_js(array('PanelsIPECacheKeys' => array($this->clean_key)), 'setting'); drupal_add_library('system', 'ui.draggable'); drupal_add_library('system', 'ui.droppable'); drupal_add_library('system', 'ui.sortable'); parent::add_meta(); }
function add_meta() { ctools_include('display-edit', 'panels'); ctools_include('content'); if (empty($this->display->cache_key)) { $this->cache = panels_edit_cache_get_default($this->display); } // @todo we may need an else to load the cache, but I am not sure we // actually need to load it if we already have our cache key, and doing // so is a waste of resources. ctools_include('cleanstring'); $this->clean_key = ctools_cleanstring($this->display->cache_key); $button = theme('panels_ipe_edit_button', array('class' => 'panels-ipe-startedit', 'text' => t('Customize this page'))); panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-startedit', $button); // panels_ipe_get_cache_key($this->clean_key); ctools_include('ajax'); ctools_include('modal'); ctools_modal_add_js(); ctools_add_css('panels_dnd', 'panels'); ctools_add_css('panels_admin', 'panels'); ctools_add_js('panels_ipe', 'panels_ipe'); ctools_add_css('panels_ipe', 'panels_ipe'); $settings = array('formPath' => url($this->get_url('save-form'))); drupal_add_js(array('PanelsIPECacheKeys' => array($this->clean_key)), 'setting'); drupal_add_js(array('PanelsIPESettings' => array($this->clean_key => $settings)), 'setting'); drupal_add_library('system', 'ui.draggable'); drupal_add_library('system', 'ui.droppable'); drupal_add_library('system', 'ui.sortable'); // drupal_add_js('misc/ui/jquery.ui.draggable.min.js'); // drupal_add_js('misc/ui/jquery.ui.droppable.min.js'); // drupal_add_js('misc/ui/jquery.ui.sortable.min.js'); // jquery_ui_add(array('ui.draggable', 'ui.droppable', 'ui.sortable')); parent::add_meta(); }
function edit_form(&$form, &$form_state) { parent::edit_form($form, $form_state); ctools_include('stack-admin', 'panels_frame'); ctools_include('plugins', 'panels'); ctools_include('ajax'); ctools_include('modal'); ctools_modal_add_js(); ctools_add_css('panels_dnd', 'panels'); ctools_add_css('panels-frame.ui-stack', 'panels_frame'); // Set the cache identifier and immediately set an object cache. $form_state['cache_key'] = panels_frame_cache_key($form_state['item']->name); if (is_object($cache = panels_frame_cache_get('stack', $form_state['cache_key']))) { $form_state['item'] = $cache; } panels_frame_cache_set('stack', $form_state['cache_key'], $form_state['item']); $form['info']['#type'] = 'container'; $form['info']['#attributes']['class'][] = 'stack-admin-info'; $form['frames'] = panels_frame_stack_edit_form(array(), $form_state); $form['frames']['#type'] = 'container'; $form['frames']['#attributes']['class'][] = 'stack-admin-frames'; $form['buttons']['#type'] = 'container'; $form['buttons']['#attributes']['class'][] = 'stack-admin-buttons'; $form['info']['plugin'] = array('#type' => 'value', '#value' => 'stack'); }
function add_meta() { ctools_include('display-edit', 'panels'); ctools_include('content'); if (empty($this->display->cache_key)) { $this->cache = panels_edit_cache_get_default($this->display); } // @todo we may need an else to load the cache, but I am not sure we // actually need to load it if we already have our cache key, and doing // so is a waste of resources. ctools_include('cleanstring'); $this->clean_key = ctools_cleanstring($this->display->cache_key); $button = array('#type' => 'link', '#title' => t('Customize this page'), '#href' => $this->get_url('save_form'), '#id' => 'panels-ipe-customize-page', '#attributes' => array('class' => array('panels-ipe-startedit', 'panels-ipe-pseudobutton')), '#ajax' => array('progress' => 'throbber', 'ipe_cache_key' => $this->clean_key), '#prefix' => '<div class="panels-ipe-pseudobutton-container">', '#suffix' => '</div>'); panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-startedit', $button); // @todo this actually should be an IPE setting instead. if (user_access('change layouts in place editing')) { $button = array('#type' => 'link', '#title' => t('Change layout'), '#href' => $this->get_url('change_layout'), '#attributes' => array('class' => array('panels-ipe-change-layout', 'panels-ipe-pseudobutton', 'ctools-modal-layout')), '#ajax' => array('progress' => 'throbber', 'ipe_cache_key' => $this->clean_key), '#prefix' => '<div class="panels-ipe-pseudobutton-container">', '#suffix' => '</div>'); panels_ipe_toolbar_add_button($this->clean_key, 'panels-ipe-change-layout', $button); } ctools_include('ajax'); ctools_include('modal'); ctools_modal_add_js(); ctools_add_css('panels_dnd', 'panels'); ctools_add_css('panels_admin', 'panels'); ctools_add_css('panels_ipe', 'panels_ipe'); // Add the JavaScript for the IPE. This must go as early as possible so // that its behaviors run first, allowing it to clone parts of the DOM // before other behaviors have been applied to them. drupal_add_js(drupal_get_path('module', 'panels_ipe') . '/js/panels_ipe.js', array('group' => JS_LIBRARY, 'weight' => -1000)); drupal_add_js(array('PanelsIPECacheKeys' => array($this->clean_key)), 'setting'); drupal_add_library('system', 'ui.draggable'); drupal_add_library('system', 'ui.droppable'); drupal_add_library('system', 'ui.sortable'); parent::add_meta(); }
function add_meta() { parent::add_meta(); if ($this->admin) { ctools_include('ajax'); ctools_include('modal'); ctools_modal_add_js(); ctools_add_js('panels-base', 'panels'); ctools_add_js('display_editor', 'panels'); ctools_add_css('panels_dnd', 'panels'); ctools_add_css('panels_admin', 'panels'); } }
function init($plugin) { parent::init($plugin); finder_inc('finder', 'finder_ui'); ctools_include('ajax'); drupal_add_css(drupal_get_path('module', 'finder_ui') . '/finder_ui.css'); // These must be added up front because of a situation where all dropbuttons // start as ordinary buttons but then get ajaxed to dropbuttons. ctools_add_js('dropbutton'); ctools_add_css('dropbutton'); $modal_options = array('opacity' => 0.7, 'background' => '#000'); drupal_add_js(array('finder-modal-style' => array('modalSize' => array('type' => 'fixed', 'width' => 1024, 'height' => 576, 'contentRight' => 0), 'modalTheme' => 'FinderUIModal', 'modalOptions' => $modal_options, 'closeImage' => '')), 'setting'); drupal_add_js(drupal_get_path('module', 'finder_ui') . '/finder_ui.js'); }
function edit_form_context(&$form, &$form_state) { ctools_include('context-admin'); ctools_context_admin_includes(); ctools_add_css('ruleset'); $form['right'] = array('#prefix' => '<div class="ctools-right-container">', '#suffix' => '</div>'); $form['left'] = array('#prefix' => '<div class="ctools-left-container clear-block">', '#suffix' => '</div>'); // Set this up and we can use CTools' Export UI's built in wizard caching, // which already has callbacks for the context cache under this name. $module = 'ctools_export_ui-' . $this->plugin['name']; $name = $this->edit_cache_get_key($form_state['item'], $form_state['form type']); ctools_context_add_context_form($module, $form, $form_state, $form['right']['contexts_table'], $form_state['item'], $name); ctools_context_add_required_context_form($module, $form, $form_state, $form['left']['required_contexts_table'], $form_state['item'], $name); ctools_context_add_relationship_form($module, $form, $form_state, $form['right']['relationships_table'], $form_state['item'], $name); }
/** * Alter everything. * * @param $info * An associative array containing the following keys: * - content: The rendered content. * - title: The content's title. * - no_blocks: A boolean to decide if blocks should be displayed. * @param $page * If TRUE then this renderer owns the page and can use theme('page') * for no blocks; if false, output is returned regardless of any no * blocks settings. * @param $context * An associative array containing the following keys: * - args: The raw arguments behind the contexts. * - contexts: The context objects in use. * - task: The task object in use. * - subtask: The subtask object in use. * - handler: The handler object in use. */ function hook_ctools_render_alter(&$info, &$page, &$context) { if ($context['handler']->name == 'my_handler') { ctools_add_css('my_module.theme', 'my_module'); } }
/** * Add listing CSS to the page. * * Override this if you need custom CSS for your list. */ function list_css() { ctools_add_css('export-ui-list'); }
function list_css() { ctools_add_css('export-ui-list'); drupal_add_css(drupal_get_path("module", "context_ui") . "/context_ui.css"); }
/** * Preprocess function for Date pager template. */ function rfht2_preprocess_date_views_pager(&$vars) { ctools_add_css('date_views', 'date_views'); $plugin = $vars['plugin']; $input = $vars['input']; $view = $plugin->view; $vars['nav_title'] = ''; $vars['next_url'] = ''; $vars['prev_url'] = ''; if (empty($view->date_info) || empty($view->date_info->min_date)) { return; } $date_info = $view->date_info; // Make sure we have some sort of granularity. $granularity = !empty($date_info->granularity) ? $date_info->granularity : 'month'; $pos = $date_info->date_arg_pos; if (!empty($input)) { $id = $plugin->options['date_id']; if (array_key_exists($id, $input) && !empty($input[$id])) { $view->args[$pos] = $input[$id]; } } $next_args = $view->args; $prev_args = $view->args; $min_date = $date_info->min_date; $max_date = $date_info->max_date; // Set up the pager link format. Setting the block identifier // will force pager style links. if (isset($date_info->date_pager_format) && $date_info->date_pager_format != 'clean' || !empty($date_info->mini)) { if (empty($date_info->block_identifier)) { $date_info->block_identifier = $date_info->pager_id; } } if (empty($date_info->hide_nav)) { $prev_date = clone $min_date; date_modify($prev_date, '-1 ' . $granularity); $next_date = clone $min_date; date_modify($next_date, '+1 ' . $granularity); $format = array('year' => 'Y', 'month' => 'Y-m', 'day' => 'Y-m-d'); switch ($granularity) { case 'week': $next_week = date_week(date_format($next_date, 'Y-m-d')); $prev_week = date_week(date_format($prev_date, 'Y-m-d')); $next_arg = date_format($next_date, 'Y-\\W') . date_pad($next_week); $prev_arg = date_format($prev_date, 'Y-\\W') . date_pad($prev_week); break; default: $next_arg = date_format($next_date, $format[$granularity]); $prev_arg = date_format($prev_date, $format[$granularity]); } $next_path = str_replace($date_info->date_arg, $next_arg, $date_info->url); $prev_path = str_replace($date_info->date_arg, $prev_arg, $date_info->url); $next_args[$pos] = $next_arg; $prev_args[$pos] = $prev_arg; $vars['next_url'] = date_pager_url($view, NULL, $next_arg); $vars['prev_url'] = date_pager_url($view, NULL, $prev_arg); $vars['next_options'] = $vars['prev_options'] = array(); } else { $next_path = ''; $prev_path = ''; $vars['next_url'] = ''; $vars['prev_url'] = ''; $vars['next_options'] = $vars['prev_options'] = array(); } // Check whether navigation links would point to // a date outside the allowed range. if (!empty($next_date) && !empty($vars['next_url']) && date_format($next_date, 'Y') > $date_info->limit[1]) { $vars['next_url'] = ''; } if (!empty($prev_date) && !empty($vars['prev_url']) && date_format($prev_date, 'Y') < $date_info->limit[0]) { $vars['prev_url'] = ''; } $vars['prev_options'] += array('attributes' => array()); $vars['next_options'] += array('attributes' => array()); $prev_title = ''; $next_title = ''; // Build next/prev link titles. switch ($granularity) { case 'year': $prev_title = t('Navigate to previous year'); $next_title = t('Navigate to next year'); break; case 'month': $prev_title = t('Navigate to previous month'); $next_title = t('Navigate to next month'); break; case 'week': $prev_title = t('Navigate to previous week'); $next_title = t('Navigate to next week'); break; case 'day': $prev_title = t('Navigate to previous day'); $next_title = t('Navigate to next day'); break; } $vars['prev_options']['attributes'] += array('title' => $prev_title); $vars['next_options']['attributes'] += array('title' => $next_title); // Add nofollow for next/prev links. $vars['prev_options']['attributes'] += array('rel' => 'nofollow'); $vars['next_options']['attributes'] += array('rel' => 'nofollow'); // Need this so we can use '«' or images in the links. $vars['prev_options'] += array('html' => TRUE); $vars['next_options'] += array('html' => TRUE); $link = FALSE; // Month navigation titles are used as links in the block view. if (!empty($date_info->mini) && $granularity == 'month') { $link = TRUE; } $params = array('granularity' => $granularity, 'view' => $view, 'link' => $link); $nav_title = theme('date_nav_title', $params); $vars['nav_title'] = $nav_title; $vars['mini'] = !empty($date_info->mini); // Get the date information from the view. $date_info = $view->date_info; // Choose the dislpay format of the month name. $format = 'F'; // Get the previous month. $dateString = $date_info->min_date; $prev_month = new DateTime($dateString); $prev_month->modify('-1 month'); $prev_pager_title = format_date($prev_month->getTimestamp(), 'custom', $format); $vars['prev_title'] = $prev_pager_title; // Get the next month. $next_month = new DateTime($dateString); $next_month->modify('+1 month'); $next_pager_title = format_date($next_month->getTimestamp(), 'custom', $format); $vars['next_title'] = $next_pager_title; }
/** * Overrides theme_links__ctools_dropbutton(). * * This override adds a wrapper div so that we can maintain appropriate * vertical spacing. */ function ember_links__ctools_dropbutton($variables) { // Check to see if the number of links is greater than 1; // otherwise just treat this like a button. if (!empty($variables['links'])) { $is_drop_button = count($variables['links']) > 1; // Add needed files if ($is_drop_button) { ctools_add_js('dropbutton'); ctools_add_css('dropbutton'); } ctools_add_css('button'); // Provide a unique identifier for every button on the page. static $id = 0; $id++; // Wrapping div $class = 'ctools-no-js'; $class .= $is_drop_button ? ' ctools-dropbutton' : ''; $class .= ' ctools-button'; if (!empty($variables['class'])) { $class .= $variables['class'] ? ' ' . implode(' ', $variables['class']) : ''; } $output = ''; $output .= '<div class="' . $class . '" id="ctools-button-' . $id . '">'; // Add a twisty if this is a dropbutton if ($is_drop_button) { $variables['title'] = $variables['title'] ? check_plain($variables['title']) : t('open'); $output .= '<div class="ctools-link">'; if ($variables['image']) { $output .= '<a href="#" class="ctools-twisty ctools-image">' . $variables['title'] . '</a>'; } else { $output .= '<a href="#" class="ctools-twisty ctools-text">' . $variables['title'] . '</a>'; } $output .= '</div>'; // ctools-link } // The button content $output .= '<div class="ctools-content">'; // Check for attributes. theme_links expects an array(). $variables['attributes'] = !empty($variables['attributes']) ? $variables['attributes'] : array(); // Remove the inline and links classes from links if they exist. // These classes are added and styled by Drupal core and mess up the default // styling of any link list. if (!empty($variables['attributes']['class'])) { $classes = $variables['attributes']['class']; foreach ($classes as $key => $class) { if ($class === 'inline' || $class === 'links') { unset($variables['attributes']['class'][$key]); } } } // Call theme_links to render the list of links. $output .= theme_links(array('links' => $variables['links'], 'attributes' => $variables['attributes'], 'heading' => '')); $output .= '</div>'; // ctools-content $output .= '</div>'; // ctools-dropbutton // Wrap the output in our container. $output = '<div class="ctools-dropbutton-wrapper">' . $output . '</div>'; return $output; } else { return ''; } }
/** * Render the panels display for a given panelizer entity. * * @param stdClass $entity * A fully-loaded entity object controlled by panelizer. * @param array $args * Optional array of arguments to pass to the panels display. * @param string $address * An optional address to send to the renderer to use for addressable * content. * * @return array * If the entity isn't panelized, this returns NULL. Otherwise, it returns an * associative array as meant for use with CTools with the following keys: * - 'content': String containing the rendered panels display output. * - 'no_blocks': Boolean defining if the panels display wants to hide core * blocks or not when being rendered. */ function render_entity($entity, $view_mode, $langcode = NULL, $args = array(), $address = NULL) { if (empty($entity->panelizer[$view_mode]) || empty($entity->panelizer[$view_mode]->display)) { return FALSE; } list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity); $panelizer = $entity->panelizer[$view_mode]; $display = $panelizer->display; $display->context = $this->get_contexts($panelizer, $entity); $display->args = $args; $display->css_id = $panelizer->css_id; // This means the IPE will use our cache which means it will get appropriate // allowed content should it be selected. $display->cache_key = implode(':', array('panelizer', $this->entity_type, $entity_id, $view_mode)); // Check to see if there is any CSS. if (!empty($panelizer->css)) { ctools_include('css'); $filename = ctools_css_retrieve($display->cache_key); if (!$filename) { $filename = ctools_css_store($display->cache_key, $panelizer->css); } drupal_add_css($filename, array('group' => CSS_THEME)); } if ($view_mode == 'page_manager') { // We think this is handled as a page, so set the current page display. panels_get_current_page_display($display); } // Allow applications to alter the panelizer and the display before rendering them. drupal_alter('panelizer_pre_render', $panelizer, $display, $entity); ctools_include('plugins', 'panels'); $renderer = panels_get_renderer($panelizer->pipeline, $display); // If the IPE is enabled, but the user does not have access to edit // the entity, load the standard renderer instead. // use class_parents so we don't try to autoload the class we // are testing. $parents = class_parents($renderer); if (!empty($parents['panels_renderer_editor']) && (!$this->panelizer_access('content', $entity, $view_mode) || !$this->entity_access('update', $entity))) { $renderer = panels_get_renderer_handler('standard', $display); } $renderer->address = $address; $info = array('content' => panels_render_display($display, $renderer), 'no_blocks' => !empty($panelizer->no_blocks)); $info['classes_array'] = array(); if (!empty($panelizer->css_class)) { ctools_include('cleanstring'); foreach (explode(' ', $panelizer->css_class) as $class) { $class = ctools_context_keyword_substitute($class, array(), $display->context); if ($class) { $info['classes_array'][] = ctools_cleanstring($class); } } } if (!empty($parents['panels_renderer_editor'])) { ctools_add_css('panelizer-ipe', 'panelizer'); ctools_add_js('panelizer-ipe', 'panelizer'); drupal_add_js(drupal_get_path('module', 'panelizer') . "/js/panelizer-ipe.js", array('group' => JS_LIBRARY)); } $info['title'] = $panelizer->display->get_title(); return $info; }
function list_css() { parent::list_css(); ctools_add_css('panels-frame.ui', 'panels_frame'); }