[ Index ]

PHP Cross Reference of PageLines DMS

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      Filter: component
  11      Loading: active
  12  */
  13  
  14  /*
  15   * Main section class
  16   *
  17   * @package PageLines DMS
  18   * @author PageLines
  19   */
  20  class PLheroUnit extends PageLinesSection {
  21  
  22  	function section_opts() {
  23  
  24          $opts = array(
  25  
  26              array(
  27                  'title'            => __( 'Hero Settings', 'pagelines' ),
  28                  'type'            => 'multi',
  29                  'opts'            => array(
  30  
  31              array(
  32                  'key'            => 'pagelines_herounit_title',
  33                  'type'            => 'text',
  34                  'label'            => __( 'Heading', 'pagelines' ) ),
  35  
  36              array(
  37                  'key'            => 'pagelines_herounit_tagline',
  38                  'type'            => 'textarea',
  39                  'label'            => __( 'Subtext', 'pagelines' ) )
  40                                          )
  41                                      ),
  42  
  43              array(
  44                  'title'            => __( 'Hero Image', 'pagelines' ),
  45                  'type'            => 'multi',
  46                  'opts'            => array(
  47              array(
  48                  'key'            => 'pagelines_herounit_image',
  49                  'type'            => 'image_upload',
  50                  'label'            => __( 'Upload Custom Image', 'pagelines' ) ),
  51              array(
  52                  'key'            => 'herounit_reverse',
  53                  'type'            => 'check',
  54                  'default'        => false,
  55                  'label'            => __( 'Reverse the Hero unit (image on left)', 'pagelines' ) ),
  56                  )),
  57  
  58              array(
  59                  'title'            => __( 'Content Widths', 'pagelines' ),
  60                  'type'            => 'multi',
  61                  'col'            => 2,
  62                  'opts'            => array(
  63  
  64              array(
  65                  'label'            => __( 'Text Area Width', 'pagelines' ),
  66                  'key'            => 'herounit_left_width',
  67                  'default'        => 'span6',
  68                  'type'            => 'select',
  69                  'opts'            => array(
  70  
  71                  'span3'            => array( 'name' => '25%' ),
  72                  'span4'            => array( 'name' => '33%' ),
  73                  'span6'            => array( 'name' => '50%' ),
  74                  'span8'            => array( 'name' => '66%' ),
  75                  'span9'            => array( 'name' => '75%' ),
  76                  'span7'            => array( 'name' => '90%' )
  77                                          )
  78                                      ),
  79  
  80              array(
  81                  'label'            => __( 'Image Area Width', 'pagelines' ),
  82                  'key'            => 'herounit_right_width',
  83                  'default'        => 'span6',
  84                  'type'            => 'select',
  85                  'opts'            => array(
  86  
  87                      'span3'            => array( 'name' => '25%' ),
  88                      'span4'            => array( 'name' => '33%' ),
  89                      'span6'            => array( 'name' => '50%' ),
  90                      'span8'            => array( 'name' => '66%' ),
  91                      'span9'            => array( 'name' => '75%' ),
  92                      'span7'            => array( 'name' => '90%' )
  93                  )
  94              )
  95          )
  96      ),
  97  
  98      array(
  99                  'title'            => __( 'Hero Action Button', 'pagelines' ),
 100                  'col'            => 2,
 101                  'type'            => 'multi',
 102                  'opts'            => array(
 103  
 104                      array(
 105                          'key'            => 'herounit_button_link',
 106                          'type'            => 'text',
 107                          'label'            => __( 'Button link destination (URL - Required)', 'pagelines' ) ),
 108  
 109                      array(
 110                          'key'            => 'herounit_button_text',
 111                          'type'            => 'text',
 112                          'label'            => __( 'Hero Button Text', 'pagelines' ) ),
 113  
 114                      array(
 115                          'key'            => 'herounit_button_target',
 116                          'type'            => 'check',
 117                          'default'        => false,
 118                          'label'            => __( 'Open link in new window', 'pagelines' ) ),
 119  
 120                      array(
 121                          'label'            => __( 'Select Button Color', 'pagelines' ),
 122                          'key'            => 'herounit_button_theme',
 123                          'default'        => 'primary',
 124                          'type'            => 'select',
 125                          'opts'            => array(
 126  
 127                              'primary'        => array( 'name' => __( 'Blue', 'pagelines' ) ),
 128                              'warning'        => array( 'name' => __( 'Orange', 'pagelines' ) ),
 129                              'important'        => array( 'name' => __( 'Red', 'pagelines' ) ),
 130                              'success'        => array( 'name' => __( 'Green', 'pagelines' ) ),
 131                              'info'            => array( 'name' => __( 'Light Blue', 'pagelines' ) ),
 132                              'reverse'        => array( 'name' => __( 'Grey', 'pagelines' ) )
 133                          )
 134                      )
 135                  )
 136              )
 137          );
 138      
 139          return $opts;
 140      
 141      }
 142  
 143  
 144      /**
 145      * Section template.
 146      */
 147     function section_template() {
 148  
 149          $hero_lt_width = $this->opt( 'herounit_left_width', $this->oset );
 150          $hero_rt_width = $this->opt( 'herounit_right_width', $this->oset );
 151             $hero_title = $this->opt( 'pagelines_herounit_title', $this->tset );
 152          $hero_tag = $this->opt( 'pagelines_herounit_tagline', $this->tset );
 153          $hero_img = $this->opt( 'pagelines_herounit_image', $this->tset );
 154          $hero_butt_link = $this->opt( 'herounit_button_link', $this->oset );
 155          $hero_butt_text = $this->opt( 'herounit_button_text', $this->oset );
 156          $hero_butt_target = ( $this->opt( 'herounit_button_target', $this->oset ) ) ? ' target="_blank"': '';
 157          $hero_butt_theme = $this->opt( 'herounit_button_theme', $this->oset );
 158          $hero_reverse = ( $this->opt( 'herounit_reverse', $this->oset ) ) ? 'pl-hero-reverse': '';
 159  
 160          if ( ! $hero_rt_width )
 161              $hero_rt_width = 'span6';
 162  
 163          if ( ! $hero_lt_width )
 164              $hero_lt_width = 'span6';
 165  
 166          $hero_title = ($hero_title) ? $hero_title : __('The Hero!', 'pagelines');
 167          $hero_tag = ($hero_tag) ? $hero_tag : __('Now just set up your Hero section options', 'pagelines');
 168  
 169  
 170  
 171             printf( '<div class="pl-hero-wrap row %s">', $hero_reverse);
 172  
 173  
 174             if( $hero_lt_width )
 175              printf( '<div class="pl-hero %s" >', $hero_lt_width );
 176              ?>
 177                  <?php
 178  
 179                      if( $hero_title )
 180                          printf( '<h1 class="m-bottom" data-sync="pagelines_herounit_title">%s</h1>', $hero_title );
 181  
 182                      if( $hero_tag )
 183                            printf( '<p data-sync="pagelines_herounit_tagline">%s</p>', $hero_tag );
 184  
 185                        if( $hero_butt_link )
 186                      printf( '<a %s class="btn btn-%s btn-large" href="%s" data-sync="herounit_button_text">%s</a> ', $hero_butt_target, $hero_butt_theme, $hero_butt_link, $hero_butt_text );
 187                    ?>
 188              </div>
 189  
 190             <?php
 191             if( $hero_rt_width )
 192              printf( '<div class="pl-hero-image %s">', $hero_rt_width);
 193  
 194          if( $hero_img )
 195              printf( '<div class="hero_image"><img class="pl-imageframe" data-sync="pagelines_herounit_image" src="%s" /></div>', apply_filters( 'pl_hero_image', $hero_img ) );
 196  
 197          ?>
 198              </div>
 199  
 200          </div>
 201  
 202          <?php
 203  
 204      }
 205  
 206  }


Generated: Sun Dec 1 19:43:16 2013 Cross-referenced by PHPXref 0.7.1