WPDK  1.5.0
WordPress Development Kit
 All Data Structures Files Functions Variables Pages
wpdk-ui-popover.php
Go to the documentation of this file.
1 <?php
2 
7 
8  const AUTO = 'auto';
9  const BOTTOM = 'bottom';
10  const LEFT = 'left';
11  const RIGHT = 'right';
12  const TOP = 'top';
13 }
14 
23 class WPDKUIPopover extends WPDKHTMLTag {
24 
32  public $animation = true;
33 
44  public $container = false;
45 
53  public $content = '';
54 
63  public $delay = 0;
64 
73  public $html = false;
74 
82  public $id = '';
83 
95 
105  public $selector = '';
106 
114  public $static = false;
115 
123  public $title = '';
124 
132  public $trigger = 'click';
133 
145  {
146  $this->id = sanitize_title( $id );
147  $this->title = $title;
148  $this->content = $content;
149  $this->placement = $placement;
150  }
151 
159  public function html()
160  {
161 
162  // Get title
163  $title = $this->title();
164  $title = empty( $title ) ? '' : sprintf( '<h3 class="popover-title">%s</h3>', $title );
165 
167 
168  <div id="<?php echo $this->id ?>"
169  class="<?php echo WPDKHTMLTag::classInline( array( 'wpdk-popover', $this->placement, $this->class, empty( $this->static ) ? '' : 'fade' ) ) ?>">
170  <?php echo self::dataInline( $this->data ) ?>
171  <div class="arrow"></div>
172  <?php echo $title ?>
173  <div class="popover-content">
174  <?php echo $this->content() ?>
175  </div>
176  </div>
177 
178  <?php
179  return WPDKHTML::endCompress();
180  }
181 
189  public function title()
190  {
191  // Override in subclass
192  return $this->title;
193  }
194 
202  public function content()
203  {
204  // Override in subclass
205  return $this->content;
206  }
207 
208 
209 
210 
211 }