Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * @file
- * Definition of the FIA wrapped style.
- */
- $plugin = array(
- 'title' => t('Custom pane wrapper plain'),
- 'render pane' => 'custom_plain_pane_wrapper_style_render_pane',
- 'pane settings form' => 'custom_plain_pane_wrapper_style_render_pane_settings_form',
- 'hook theme' => array(
- 'custom_pane_wrapper_plain' => array(
- 'variables' => array(
- 'wrapper' => NULL,
- 'css_id' => NULL,
- 'css_class' => NULL,
- 'title' => NULL,
- 'title_prefix' => NULL,
- 'title_suffix' => NULL,
- 'title_wrapper' => NULL,
- 'title_id' => NULL,
- 'title_class' => NULL,
- 'title_hide' => FALSE,
- 'content' => NULL,
- ),
- 'path' => drupal_get_path('theme', 'penceo_theme') . '/plugins/styles/general/custom_pane_wrapper_plain',
- 'template' => 'custom-pane-wrapper-plain',
- ),
- ),
- );
- /**
- * Render callback.
- *
- * @ingroup themeable
- */
- function theme_custom_plain_pane_wrapper_style_render_pane($vars) {
- $settings = $vars['settings'];
- $options = array(
- 'wrapper' => $settings['pane']['wrapper'] != 'none' ? $settings['pane']['wrapper'] : NULL,
- 'css_id' => $settings['pane']['css_id'] != '' ? $settings['pane']['css_id'] : NULL,
- 'css_class' => $settings['pane']['css_class'] != '' ? $settings['pane']['css_class'] : NULL,
- 'title' => isset($vars['content']->title) ? $vars['content']->title : NULL,
- 'title_prefix' => isset($vars['content']->title_prefix) ? $vars['content']->title_prefix : NULL,
- 'title_suffix' => isset($vars['content']->title_suffix) ? $vars['content']->title_suffix : NULL,
- 'title_wrapper' => $settings['title']['title_wrapper'] != 'none' ? $settings['title']['title_wrapper'] : NULL,
- 'title_hide' => isset($settings['title']['title_hide']) ? $settings['title']['title_hide'] : FALSE,
- 'content' => $vars['content']->content,
- );
- if ($settings['title']['title_class'] != '') {
- $options['title_attributes_array']['class'] = array($settings['title']['title_class']);
- }
- if ($settings['title']['title_id']) {
- $options['title_attributes_array']['id'] = $settings['title']['title_id'];
- }
- $options['admin_links'] = '';
- $content =& $vars['content'];
- if (module_exists('contextual') && user_access('access contextual links')) {
- $links = array();
- // These are specified by the content.
- if (!empty($content->admin_links)) {
- $links += $content->admin_links;
- }
- // Take any that may have been in the render array we were given and
- // move them up so they appear outside the pane properly.
- if (is_array($content->content) && isset($content->content['#contextual_links'])) {
- $element = array(
- '#type' => 'contextual_links',
- '#contextual_links' => $content->content['#contextual_links'],
- );
- unset($content->content['#contextual_links']);
- // Add content to $element array.
- if (is_array($content->content)) {
- $element['#element'] = $content->content;
- }
- $element = contextual_pre_render_links($element);
- if (!empty($element['#links'])) {
- $links += $element['#links'];
- }
- }
- if ($links) {
- $build = array(
- '#prefix' => '<div class="contextual-links-wrapper">',
- '#suffix' => '</div>',
- '#theme' => 'links__contextual',
- '#links' => $links,
- '#attributes' => array('class' => array('contextual-links')),
- '#attached' => array(
- 'library' => array(array('contextual', 'contextual-links')),
- ),
- );
- if (isset($options['css_class'])) {
- $options['css_class'] .= ' contextual-links-region';
- }
- else {
- $options['css_class'] = 'contextual-links-region';
- }
- $options['admin_links'] = drupal_render($build);
- }
- }
- return theme('custom_pane_wrapper_plain', $options);
- }
- /**
- * Settings form callback.
- */
- function custom_plain_pane_wrapper_style_render_pane_settings_form($style_settings) {
- $form = array();
- $wrap_tags = array(
- 'div' => t('DIV'),
- 'h1' => t('H1'),
- 'h2' => t('H2'),
- 'h3' => t('H3'),
- 'h4' => t('H4'),
- 'h5' => t('H5'),
- 'h6' => t('H6'),
- 'span' => t('SPAN'),
- 'p' => t('P'),
- 'nav' => t('Nav'),
- 'article' => t('ARTICLE'),
- 'section' => t('SECTION'),
- 'aside' => t('ASIDE'),
- );
- $form['pane'] = array(
- '#type' => 'fieldset',
- '#title' => t('Pane settings'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- );
- $form['pane']['wrapper'] = array(
- '#title' => t('Wrapper'),
- '#type' => 'select',
- '#default_value' => !empty($style_settings['pane']['wrapper']) ? $style_settings['pane']['wrapper'] : 'none',
- '#options' => $wrap_tags,
- '#empty_value' => 'none',
- '#empty_option' => t('No wrapper'),
- );
- $form['pane']['css_id'] = array(
- '#type' => 'textfield',
- '#title' => t('CSS ID'),
- '#default_value' => (isset($style_settings['pane']['css_id'])) ? $style_settings['pane']['css_id'] : '',
- );
- $form['pane']['css_class'] = array(
- '#type' => 'textfield',
- '#title' => t('CSS classes'),
- '#default_value' => (isset($style_settings['pane']['css_class'])) ? $style_settings['pane']['css_class'] : '',
- );
- $form['title'] = array(
- '#type' => 'fieldset',
- '#title' => t('Title settings'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- );
- $form['title']['title_wrapper'] = array(
- '#title' => t('Wrapper'),
- '#type' => 'select',
- '#default_value' => !empty($style_settings['title']['title_wrapper']) ? $style_settings['title']['title_wrapper'] : 'none',
- '#options' => $wrap_tags,
- '#empty_value' => 'none',
- '#empty_option' => t('No wrapper'),
- );
- $form['title']['title_class'] = array(
- '#type' => 'textfield',
- '#title' => t('Title CSS classes'),
- '#default_value' => (isset($style_settings['title']['title_class'])) ? $style_settings['title']['title_class'] : '',
- );
- $form['title']['title_id'] = array(
- '#type' => 'textfield',
- '#title' => t('Title CSS ID'),
- '#default_value' => (isset($style_settings['title']['title_id'])) ? $style_settings['title']['title_id'] : '',
- );
- $form['title']['title_hide'] = array(
- '#type' => 'checkbox',
- '#title' => t('Hide title'),
- '#default_value' => (isset($style_settings['title']['hide_title'])) ? $style_settings['title']['hide_title'] : FALSE,
- );
- return $form;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement