accordion-item.php
5 months ago
accordion.php
5 months ago
columns.php
5 months ago
control-group-item.php
5 months ago
control-group.php
5 months ago
div.php
5 months ago
form-group.php
5 months ago
index.php
6 months ago
more-link.php
5 months ago
tab-item.php
5 months ago
tab.php
5 months ago
control-group-item.php
71 lines
| 1 | <?php |
| 2 | /** |
| 3 | * The file contains the class of Tab Control Holder. |
| 4 | * |
| 5 | * @package factory-forms |
| 6 | * @since 1.0.0 |
| 7 | */ |
| 8 | |
| 9 | // Exit if accessed directly |
| 10 | if ( ! defined( 'ABSPATH' ) ) { |
| 11 | exit; |
| 12 | } |
| 13 | |
| 14 | if ( ! class_exists( 'Wbcr_FactoryForms600_ControlGroupItem' ) ) { |
| 15 | |
| 16 | /** |
| 17 | * Tab Control Holder |
| 18 | * |
| 19 | * @since 1.0.0 |
| 20 | */ |
| 21 | class Wbcr_FactoryForms600_ControlGroupItem extends Wbcr_FactoryForms600_Holder { |
| 22 | |
| 23 | /** |
| 24 | * A holder type. |
| 25 | * |
| 26 | * @since 1.0.0 |
| 27 | * @var string |
| 28 | */ |
| 29 | public $type = 'control-group-item'; |
| 30 | |
| 31 | |
| 32 | /** |
| 33 | * Here we should render a beginning html of the tab. |
| 34 | * |
| 35 | * @since 1.0.0 |
| 36 | * @return void |
| 37 | */ |
| 38 | public function beforeRendering() { |
| 39 | $this->addCssClass( 'control-group-item' ); |
| 40 | $this->addCssClass( 'factory-control-group-item-' . $this->options['name'] ); |
| 41 | |
| 42 | if ( $this->parent->getValue() == $this->options['name'] ) { |
| 43 | $this->addCssClass( 'current' ); |
| 44 | |
| 45 | foreach ( $this->elements as $val ) { |
| 46 | $val->setOption( 'isActive', 1 ); |
| 47 | } |
| 48 | } else { |
| 49 | foreach ( $this->elements as $val ) { |
| 50 | $val->setOption( 'isActive', 0 ); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | ?> |
| 55 | <div <?php $this->attrs(); ?>> |
| 56 | <?php |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Here we should render an end html of the tab. |
| 61 | * |
| 62 | * @since 1.0.0 |
| 63 | * @return void |
| 64 | */ |
| 65 | public function afterRendering() { |
| 66 | ?> |
| 67 | </div> |
| 68 | <?php |
| 69 | } |
| 70 | } |
| 71 | } |