[ Index ]

PHP Cross Reference of PageLines Framework

title

Body

[close]

/sections/hero/ -> section.php (source)

   1  <?php
   2  /*
   3      Section: Hero
   4      Author: PageLines
   5      Author URI: http://www.pagelines.com
   6      Description: A responsive full width image and text area with button.
   7      Class Name: PLheroUnit
   8      Workswith: templates, main, header, morefoot, content
   9      Cloning: true
  10  */
  11  
  12  /*
  13   * Main section class
  14   *
  15   * @package PageLines Framework
  16   * @author PageLines
  17   */
  18  class PLheroUnit extends PageLinesSection {
  19  
  20      var $tabID = 'herounit_meta';
  21  
  22  
  23  	function section_optionator( $settings ){
  24  
  25          $settings = wp_parse_args($settings, $this->optionator_default);
  26  
  27  
  28          $option_array = array(
  29  
  30                  'pagelines_herounit_text' => array(
  31                          'type'                 => 'multi_option',
  32                          'inputlabel'         => 'Enter text for your Hero section',
  33                          'title'             => $this->name.' Text',
  34                          'selectvalues'    => array(
  35                              'pagelines_herounit_title' => array(
  36                                  'type'  => 'text',
  37                                  'inputlabel'=>'Heading',
  38                              ),
  39                              'pagelines_herounit_tagline' => array(
  40                                  'type'   => 'textarea',
  41                                  'inputlabel'=>'Subtext'
  42                              )
  43                          ),
  44                          'shortexp'             => 'The text for the Hero section Header and Subtext content.',
  45                          'exp'                 => 'The title is used for the heading, and the subtext is placed directly beneath it.'
  46  
  47                  ),
  48                  'pagelines_herounit_image' => array(
  49                      'type'             => 'image_upload',
  50                      'imagepreview'     => '270',
  51                      'inputlabel'     => 'Upload custom image',
  52                      'title'         => $this->name.' Image',
  53                      'shortexp'         => 'Input Full URL to your custom Hero image.',
  54                      'exp'             => 'Places a custom image to the right of the call to action and text.'
  55                  ),
  56                  'pagelines_herounit_cta' => array(
  57                      'type'        => 'multi_option',
  58                      'title'        => __('Hero Action Button', 'pagelines'),
  59                      'shortexp'    => __('Enter the options for the Hero button', 'pagelines'),
  60                      'selectvalues'    => array(
  61                          'herounit_button_link' => array(
  62                              'type' => 'text',
  63                              'inputlabel' => 'Button link destination (URL - Required)',
  64                          ),
  65                          'herounit_button_text' => array(
  66                              'type'             => 'text',
  67                              'inputlabel'     => 'Hero Button Text',
  68                          ),
  69                          'herounit_button_target' => array(
  70                              'type'            => 'check',
  71                              'default'        => false,
  72                              'inputlabel'    => 'Open link in new window.',
  73                          ),
  74                          'herounit_button_theme' => array(
  75                              'type'            => 'select',
  76                              'default'        => false,
  77                              'inputlabel'    => 'Select Button Color',
  78                              'selectvalues'    => array(
  79                                  'primary'    => array('name' => 'Blue'),
  80                                  'warning'    => array('name' => 'Orange'),
  81                                  'important'    => array('name' => 'Red'),
  82                                  'success'    => array('name' => 'Green'),
  83                                  'info'        => array('name' => 'Light Blue'),
  84                                  'reverse'    => array('name' => 'Grey'),
  85                              ),
  86                          ),
  87                      ),
  88                  ),
  89                  'pagelines_herounit_widths' => array(
  90                      'type'        => 'multi_option',
  91                      'title'        => __('Content Widths', 'pagelines'),
  92                      'shortexp'    => __('Select the width of the image and text areas', 'pagelines'),
  93                      'selectvalues'    => array(
  94                          'herounit_left_width' => array(
  95                              'type'            => 'select',
  96                              'default'        => 'span6',
  97                              'inputlabel'    => 'Text Area Width',
  98                              'selectvalues'    => array(
  99                                  'span3'     => array('name' => '25%'),
 100                                  'span4'     => array('name' => '33%'),
 101                                  'span6'     => array('name' => '50%'),
 102                                  'span8'     => array('name' => '66%'),
 103                                  'span9'     => array('name' => '75%'),
 104                                  'span7'     => array('name' => '90%'),
 105                              ),
 106                          ),
 107                          'herounit_right_width' => array(
 108                              'type'            => 'select',
 109                              'default'        => 'span6',
 110                              'inputlabel'    => 'Image Area Width',
 111                              'selectvalues'    => array(
 112                                  'span3'     => array('name' => '25%'),
 113                                  'span4'     => array('name' => '33%'),
 114                                  'span6'     => array('name' => '50%'),
 115                                  'span8'     => array('name' => '66%'),
 116                                  'span9'     => array('name' => '75%'),
 117                                  'span7'     => array('name' => '90%'),
 118                              ),
 119                          ),
 120                      ),
 121                  ),
 122          );
 123  
 124          $metatab_settings = array(
 125                  'id'         => $this->tabID,
 126                  'name'         => 'Hero Unit',
 127                  'icon'         => $this->icon,
 128                  'clone_id'    => $settings['clone_id'],
 129                  'active'    => $settings['active']
 130              );
 131  
 132          register_metatab($metatab_settings, $option_array);
 133  
 134  
 135      }
 136  
 137      /**
 138      * Section template.
 139      */
 140     function section_template( $clone_id ) {
 141  
 142          $hero_lt_width = ploption( 'herounit_left_width', $this->oset );
 143               if ( ! $hero_lt_width )$hero_lt_width = 'span6';
 144          $hero_rt_width = ploption( 'herounit_right_width', $this->oset );
 145              if ( ! $hero_rt_width )$hero_rt_width = 'span6';
 146             $hero_title = ploption( 'pagelines_herounit_title', $this->tset );
 147          $hero_tag = ploption( 'pagelines_herounit_tagline', $this->tset );
 148          $hero_img = ploption( 'pagelines_herounit_image', $this->tset );
 149          $hero_butt_link = ploption( 'herounit_button_link', $this->oset );
 150          $hero_butt_text = ploption( 'herounit_button_text', $this->oset );
 151          $hero_butt_target = ( ploption( 'herounit_button_target', $this->oset ) ) ? ' target="_blank"': '';
 152          $hero_butt_theme = ploption( 'herounit_button_theme', $this->oset );
 153  
 154             if($hero_title)    { ?>
 155  
 156             <div class="pl-hero-wrap row">
 157  
 158             <?php
 159             if($hero_lt_width)
 160              printf('<div class="pl-hero %s">',$hero_lt_width);
 161              ?>
 162                  <?php
 163  
 164                      if($hero_title)
 165                          printf('<h1 class="m-bottom">%s</h1>',$hero_title);
 166  
 167                      if($hero_tag)
 168                            printf('<p>%s</p>',$hero_tag);
 169  
 170                        if($hero_butt_link)
 171                      printf('<a %s class="btn btn-%s btn-large" href="%s">%s</a> ', $hero_butt_target, $hero_butt_theme, $hero_butt_link, $hero_butt_text);
 172                    ?>
 173              </div>
 174  
 175             <?php
 176             if($hero_rt_width)
 177              printf('<div class="pl-hero-image %s">',$hero_rt_width);
 178              ?>
 179                  <?php
 180  
 181                      if($hero_img)
 182                          printf('<div class="hero_image"><img class="pl-imageframe" src="%s" /></div>', apply_filters( 'pl_hero_image', $hero_img ) );
 183  
 184                  ?>
 185              </div>
 186  
 187          </div>
 188  
 189          <?php
 190  
 191          } else
 192              echo setup_section_notify($this, __('Set Hero page options to activate.', 'pagelines') );
 193      }
 194  
 195  }


Generated: Sat Apr 6 23:00:27 2013 Cross-referenced by PHPXref 0.7.1