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


Generated: Wed Jul 9 23:44:08 2014 Cross-referenced by PHPXref 0.7.1