|
|
Drupal example source code file (panels_ipe.module)
The panels_ipe.module Drupal example source code<?php /** * Implementation of hook_ctools_plugin_directory(). */ function panels_ipe_ctools_plugin_directory($module, $plugin) { if ($module == 'panels' && $plugin == 'display_renderers') { return 'plugins/' . $plugin; } } /** * Implementation of hook_ctools_plugin_api(). * * Inform CTools about version information for various plugins implemented by * Panels. * * @param string $owner * The system name of the module owning the API about which information is * being requested. * @param string $api * The name of the API about which information is being requested. */ function panels_ipe_ctools_plugin_api($owner, $api) { if ($owner == 'panels' && $api == 'pipelines') { return array( 'version' => 1, 'path' => drupal_get_path('module', 'panels_ipe') . '/includes', ); } } /** * Implementation of hook_theme(). */ function panels_ipe_theme() { return array( 'panels_ipe_pane_wrapper' => array( 'variables' => array('output' => NULL, 'pane' => NULL, 'display' => NULL, 'renderer' => NULL), ), 'panels_ipe_region_wrapper' => array( 'variables' => array('output' => NULL, 'region_id' => NULL, 'display' => NULL, 'renderer' => NULL), ), 'panels_ipe_add_pane_button' => array( 'variables' => array('region_id' => NULL, 'display' => NULL, 'renderer' => NULL), ), 'panels_ipe_placeholder_pane' => array( 'variables' => array('region_id' => NULL, 'region_title' => NULL), ), 'panels_ipe_dnd_form_container' => array( 'variables' => array('link' => NULL, 'cache_key' => NULL, 'display' => NULL), ), ); } /** * Theme the 'placeholder' pane, which is shown on an active IPE when no panes * live in that region. * * @param string $region_id * @param string $region_title */ function theme_panels_ipe_placeholder_pane($vars) { $region_id = $vars['region_id']; $region_title = $vars['region_title']; $output = '<div class="panels-ipe-placeholder-content">'; $output .= "<h3>$region_title</h3>"; $output .= '</div>'; return $output; } function theme_panels_ipe_pane_wrapper($vars) { $output = $vars['output']; $pane = $vars['pane']; $display = $vars['display']; $renderer = $vars['renderer']; $content_type = ctools_get_content_type($pane->type); $subtype = ctools_content_get_subtype($content_type, $pane->subtype); $links = array(); if (ctools_content_editable($content_type, $subtype, $pane->configuration)) { $links['edit'] = array( 'title' => isset($content_type['edit text']) ? $content_type['edit text'] : t('Settings'), 'href' => $renderer->get_url('edit-pane', $pane->pid), 'attributes' => array( 'class' => 'ctools-use-modal', // 'id' => "pane-edit-panel-pane-$pane->pid", ), ); } // Deleting is managed entirely in the js; this is just an attachment point // for it $links['delete'] = array( 'title' => t('Delete'), 'href' => '#', 'attributes' => array( 'class' => 'pane-delete', 'id' => "pane-delete-panel-pane-$pane->pid", ), ); $attributes = array( 'class' => 'panels-ipe-linkbar', ); $links = theme('links', array('links' => $links, 'attributes' => $attributes)); $links .= '<div class="panels-ipe-draghandle"> </div>'; $handlebar = '<div class="panels-ipe-handlebar-wrapper panels-ipe-on clearfix">' . $links . '</div>'; return $handlebar . $output; } function theme_panels_ipe_region_wrapper($vars) { return $vars['output']; } function theme_panels_ipe_add_pane_button($vars) { $region_id = $vars['region_id']; $display = $vars['display']; $renderer = $vars['renderer']; $attributes = array('class' => 'ctools-use-modal'); $link = l(t('Add new pane'), $renderer->get_url('select-content', $region_id), array('attributes' => $attributes)); return '<div class="panels-ipe-newblock panels-ipe-on panels-ipe-portlet-static">' . $link . '</div>'; } function panels_ipe_get_cache_key($key = NULL) { static $cache; if (isset($key)) { $cache = $key; } return $cache; } /** * Implementation of hook_footer() * * Adds the IPE control container. * * @param unknown_type $main */ function panels_ipe_page_alter(&$page) { $key = panels_ipe_get_cache_key(); if (!isset($key)) { return; } // TODO should be moved into the IPE plugin - WAAAY too hardcoded right now $output = "<div id='panels-ipe-control-container' class='clearfix'>"; $output .= "<div id='panels-ipe-control-$key' class='panels-ipe-control'>"; $output .= "<div class='panels-ipe-startedit panels-ipe-pseudobutton panels-ipe-off'>"; $output .= "<span>" . t('Customize this page') . "</span>"; $output .= "</div>"; $output .= "<div class='panels-ipe-form-container panels-ipe-on clearfix'</div>"; $output .= "</div></div>"; $page['page_bottom']['panels_ipe'] = array( '#markup' => $output, ); } Other Drupal examples (source code examples)Here is a short list of links related to this Drupal panels_ipe.module source code file: |
"Drupal" is a registered trademark of Dries Buytaert.
my drupal tutorials and examples
Copyright
1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.
Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.