SB_Controls_Base.php
| 1 | <?php |
| 2 | /** |
| 3 | * Customizer Builder Control Base |
| 4 | * |
| 5 | * @since 2.0 |
| 6 | */ |
| 7 | namespace TwitterFeed\Builder\Controls; |
| 8 | |
| 9 | if(!defined('ABSPATH')) exit; |
| 10 | |
| 11 | abstract class SB_Controls_Base{ |
| 12 | |
| 13 | /** |
| 14 | * Get control type. |
| 15 | * |
| 16 | * Getting the Control Type |
| 17 | * |
| 18 | * @since 2.0 |
| 19 | * @access public |
| 20 | * |
| 21 | * @return string |
| 22 | */ |
| 23 | public function get_type(){ |
| 24 | return ''; |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Get control info. |
| 29 | * |
| 30 | * Getting the Control information [] |
| 31 | * |
| 32 | * @since 2.0 |
| 33 | * @access public |
| 34 | * |
| 35 | * @return array |
| 36 | */ |
| 37 | public function get_info(){ |
| 38 | return [ |
| 39 | 'id' => '', |
| 40 | 'type' => '', |
| 41 | 'modelname' => '', |
| 42 | 'layout' => 'full', |
| 43 | 'reverse' => 'false', |
| 44 | 'default' => '', |
| 45 | 'seperator' => 'none', |
| 46 | 'heading' => '', |
| 47 | 'description' => '', |
| 48 | 'tooltip' => '', |
| 49 | ]; |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Control Output |
| 54 | * |
| 55 | * |
| 56 | * @since 2.0 |
| 57 | * @access public |
| 58 | * |
| 59 | * @return HTML |
| 60 | */ |
| 61 | public function get_control_output($controlEditingTypeModel){} |
| 62 | |
| 63 | /** |
| 64 | * Getting Editing Control Type |
| 65 | * |
| 66 | * |
| 67 | * @since 1.0.0 |
| 68 | * @access public |
| 69 | * |
| 70 | * @return String |
| 71 | */ |
| 72 | public function get_control_edit_type($editingType){ |
| 73 | switch ($editingType) { |
| 74 | case 'settings': |
| 75 | return 'customizerFeedData.settings'; |
| 76 | break; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Get Control HTML. |
| 82 | * |
| 83 | * |
| 84 | * @since 2.0 |
| 85 | * @access public |
| 86 | * |
| 87 | * @return HTML |
| 88 | */ |
| 89 | public function print_control_wrapper($editingType){ |
| 90 | $control_type = $this->get_type(); |
| 91 | $controlEditingTypeModel = $this->get_control_edit_type($editingType); |
| 92 | ?> |
| 93 | |
| 94 | <div class="sb-control-elem-ctn ctf-fb-fs" v-if="control.type == '<?php echo $control_type ?>'" |
| 95 | v-show="isControlShown(control)" |
| 96 | :data-child="control.child ? 'true' : false" |
| 97 | :data-separator="control.separator != undefined ? control.separator : 'none'" |
| 98 | :data-type="control.type" :data-layout="control.layout == undefined ? 'block' : 'half'" |
| 99 | :data-reverse="control.reverse != undefined ? 'true' : 'false'" :data-stacked="control.stacked ? 'true' : 'false'" |
| 100 | :data-heading="control.strongHeading != undefined && control.strongHeading != 'true' ? '' : 'strong'" |
| 101 | :data-disabled="control.disabledInput != undefined ? isControlShown(control) : false" |
| 102 | :data-switcher-top="control.switcherTop != undefined ? 'true' : false" |
| 103 | :data-align-description="control.alignDescription != undefined ? 'true' : false" |
| 104 | |
| 105 | > |
| 106 | |
| 107 | <div class="sb-control-elem-overlay" |
| 108 | v-show="control.condition != undefined || control.checkExtension != undefined || control.checkExtensionDimmed != undefined ? !checkControlCondition(control.condition, control.checkExtension, control.checkExtensionDimmed) : false" |
| 109 | @click.prevent.default="control.checkExtensionPopup != undefined && !checkExtensionActive(control.checkExtensionPopup) ? viewsActive.extensionsPopupElement = control.checkExtensionPopup : false" |
| 110 | :class="control.checkExtensionPopup != undefined && !checkExtensionActive(control.checkExtensionPopup) ? 'sb-cursor-pointer' : ''" |
| 111 | > |
| 112 | </div> |
| 113 | |
| 114 | <div class="sb-control-elem-label" v-if="(control.heading == undefined && control.description == undefined) ? false : true && control.type != 'customview'"> |
| 115 | <div class="sb-control-elem-label-title ctf-fb-fs"> |
| 116 | <div v-if="control.icon != undefined" class="sb-control-elem-icon" v-html="svgIcons[control.icon]"></div> |
| 117 | <div class="sb-control-elem-heading sb-small-p sb-dark-text" :data-underline="control.underline" :class="control.enableViewAction != undefined && control.enableViewAction != false ? 'sb-cursor-pointer' : ''" @click.prevent.default="control.enableViewAction != undefined && control.enableViewAction != false ? switchNestedSection(control.enableViewAction, null ) : false"> |
| 118 | <span v-html="control.heading"></span> |
| 119 | <span v-if="control.proLabel != undefined && control.proLabel" class="sb-breadcrumb-pro-label">PRO</span> |
| 120 | </div> |
| 121 | <div class="sb-control-elem-tltp" v-if="control.tooltip != undefined" @mouseover.prevent.default="toggleElementTooltip(control.tooltip, 'show', control.tooltipAlign ? control.tooltipAlign : 'center' )" @mouseleave.prevent.default="toggleElementTooltip('', 'hide')"> |
| 122 | <div class="sb-control-elem-tltp-icon" v-html="svgIcons['info']"></div> |
| 123 | </div> |
| 124 | </div> |
| 125 | <div class="sb-control-elem-description" v-if="control.descriptionPosition != 'bottom'"> |
| 126 | <span v-html="control.description"></span> |
| 127 | <a v-if="control.checkExtensionPopupLearnMore != undefined" @click.prevent.default="control.utmLink != undefined ? window.open(control.utmLink, '_blank') : viewsActive.extensionsPopupElement = control.checkExtensionPopupLearnMore">{{genericText.learnMore}}</a> |
| 128 | </div> |
| 129 | </div> |
| 130 | <div class="sb-control-elem-output"> |
| 131 | <?php $this->get_control_output($controlEditingTypeModel); ?> |
| 132 | <div class="sb-control-elem-description" v-if="control.descriptionPosition != undefined && control.descriptionPosition == 'bottom'" v-html="control.description"></div> |
| 133 | </div> |
| 134 | </div> |
| 135 | <?php |
| 136 | } |
| 137 | |
| 138 | } |