* @copyright (c) 2018, Webcraftic Ltd * * @package factory-forms * @since 1.0.0 */ // Exit if accessed directly if( !defined('ABSPATH') ) { exit; } if( !class_exists('Wbcr_FactoryForms480_MultipleTextboxControl') ) { class Wbcr_FactoryForms480_MultipleTextboxControl extends Wbcr_FactoryForms480_Control { public $type = 'multiple-textbox'; /** * Preparing html attributes before rendering html of the control. * * @since 1.0.0 * @return void */ protected function beforeHtml() { $name_on_form = $this->getNameOnForm(); if( $this->getOption('maxLength', false) ) { $this->addHtmlAttr('maxlength', intval($this->getOption('maxLength'))); } if( $this->getOption('placeholder', false) ) { $this->addHtmlAttr('placeholder', $this->getOption('placeholder')); } $this->addCssClass('form-control'); $this->addHtmlAttr('type', 'text'); //$this->addHtmlAttr('id', $name_on_form); $this->addCssClass(str_replace('_', '-', $name_on_form)); $this->addHtmlAttr('name', $name_on_form . '[]'); } /** * Shows the html markup of the control. * * @since 1.0.0 * @return void */ public function html() { $values = $this->getValue(); if( !empty($values) ) { $values = explode('{%spr%}', $values); } else { $values = array(); } ?>
attrs() ?>/>
attrs() ?>/> = 1 ): ?>
getNameOnForm($name); $value = isset($_POST[$name_on_form]) ? $_POST[$name_on_form] : null; if( is_array($value) ) { $value = array_map('sanitize_text_field', $value); $value = implode('{%spr%}', $value); } $value = sanitize_text_field($value); return $value; } } }