| 1 |
<?php |
| 2 |
|
| 3 |
class WPUPG_Template_Title extends WPUPG_Template_Block { |
| 4 |
|
| 5 |
public $text; |
| 6 |
public $tag; |
| 7 |
|
| 8 |
public $editorField = 'title'; |
| 9 |
|
| 10 |
public function __construct( $type = 'title' ) |
| 11 |
{ |
| 12 |
parent::__construct( $type ); |
| 13 |
} |
| 14 |
|
| 15 |
public function text( $text ) |
| 16 |
{ |
| 17 |
$this->text = $text; |
| 18 |
return $this; |
| 19 |
} |
| 20 |
|
| 21 |
public function tag( $tag ) |
| 22 |
{ |
| 23 |
$this->tag = $tag; |
| 24 |
return $this; |
| 25 |
} |
| 26 |
|
| 27 |
public function output( $post, $args = array() ) |
| 28 |
{ |
| 29 |
if( !$this->output_block( $post, $args ) ) return ''; |
| 30 |
|
| 31 |
$output = $this->before_output(); |
| 32 |
|
| 33 |
switch( $this->text ) { |
| 34 |
default: |
| 35 |
$string = $this->text; |
| 36 |
} |
| 37 |
|
| 38 |
$tag = isset( $this->tag ) ? $this->tag : 'span'; |
| 39 |
$output .= '<' . $tag . $this->style() . '>' . $string . '</' . $tag . '>'; |
| 40 |
|
| 41 |
return $this->after_output( $output, $post ); |
| 42 |
} |
| 43 |
} |