PluginProbe
Disable Comments & Delete All Comments / trunk
Disable Comments & Delete All Comments vtrunk
1.3.3 1.3.2 trunk 1.0.0 1.0.4 1.0.5 1.0.8 1.0.9 1.1.1 1.1.3 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.3.0 1.3.1
comments-plus / libs / factory / forms / controls / holders / control-group.php

control-group.php in Disable Comments & Delete All Comments trunk, at libs/factory/forms/controls/holders/control-group.php

97 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The file contains the class of Tab Control Holder.
4 *
5 * @author Alex Kovalev <alex.kovalevv@gmail.com>
6 * @copyright (c) 2018, Webcraftic Ltd
7 *
8 * @package factory-forms
9 * @since 1.0.0
10 */
11
12 // Exit if accessed directly
13 if( !defined('ABSPATH') ) {
14 exit;
15 }
16
17 if( !class_exists('Wbcr_FactoryForms480_ControlGroupHolder') ) {
18
19 /**
20 * Tab Control Holder
21 *
22 * @since 1.0.0
23 */
24 class Wbcr_FactoryForms480_ControlGroupHolder extends Wbcr_FactoryForms480_ControlHolder {
25
26 /**
27 * A holder type.
28 *
29 * @since 1.0.0
30 * @var string
31 */
32 public $type = 'control-group';
33
34
35 /**
36 * Here we should render a beginning html of the tab.
37 *
38 * @since 1.0.0
39 * @return void
40 */
41 public function beforeRendering()
42 {
43 $name = $this->getNameOnForm();
44 $value = $this->getValue();
45
46 $title = $this->getOption('title', null);
47
48 ?>
49 <div <?php $this->attrs() ?>>
50 <input type="hidden" name="<?php echo $name ?>" id="<?php echo $name ?>" class="factory-ui-control-group" value="<?php echo $value ?>"/>
51
52 <?php if( $title ) { ?>
53 <strong class="factory-header"><?php echo $title; ?></strong>
54 <?php } ?>
55
56 <ul class="factory-control-group-nav">
57 <?php
58 foreach($this->elements as $element):
59
60 if( $element->options['type'] !== 'control-group-item' ) {
61 continue;
62 }
63
64 $builder = new Wbcr_FactoryForms480_HtmlAttributeBuilder();
65
66 $builder->addCssClass('factory-control-group-nav-label');
67 $builder->addCssClass('factory-control-group-nav-label-' . $element->getOption('name'));
68 $builder->addHtmlData('control-id', 'factory-control-group-item-' . $element->getOption('name'));
69 $builder->addHtmlData('control-name', $element->getOption('name'));
70
71 if( $value == $element->getOption('name') ) {
72 $builder->addCssClass('current');
73 }
74
75 ?>
76 <li <?php $builder->printAttrs(); ?>><?php $element->title(); ?></li>
77 <?php endforeach; ?>
78 </ul>
79 <div class="factory-control-group-body">
80 <?php
81 }
82
83 /**
84 * Here we should render an end html of the tab.
85 *
86 * @since 1.0.0
87 * @return void
88 */
89 public function afterRendering()
90 {
91 ?>
92 </div>
93 </div>
94 <?php
95 }
96 }
97 }