_config = $settingsManager->getOptions(); } // Generates a selectform based on settings-name public function displaySelect($title, $optionName, $values, $options=array()){ // open setting block $this->settingsHeader($optionName, $title, 'select'); // element attributes $attb = array( 'name' => 'enlighter-options[' . $optionName . ']', 'id' => 'enlighter-' . $optionName, 'class' => (isset($options['cssClass']) ? $options['cssClass'] : '') ); // wrap into label echo HtmlUtil::generateTag('label', array( 'for' => 'enlighter-' . $optionName ), false); // generate tag, escape attributes echo HtmlUtil::generateTag('select', $attb, false); // generate option list foreach ($values as $optionValue=>$optionDescription){ $selected = ($this->_config[$optionName] == $optionValue) ? 'selected="selected"' : ''; echo ''; } echo ''; // add label text ? if (isset($options['label'])){ echo HtmlUtil::generateTag('span', array( 'class' => 'enlighter-label-text' ), true, esc_html($options['label'])); } // close label echo ''; // close setting block $this->settingsFooter($options); } // Generates a checkbox based on the settings-name public function displayCheckbox($title, $optionName, $options=array()){ // open setting block $this->settingsHeader($optionName, $title, 'checkbox'); // dummy element attributes $attb = array( 'name' => 'enlighter-options[' . $optionName . ']', 'type' => 'hidden', 'value' => '0' ); // dummy checkbox (unchecked value) echo HtmlUtil::generateTag('input', $attb, true); // wrap into label echo HtmlUtil::generateTag('label', array( 'for' => 'enlighter-' . $optionName, ), false); // element attributes $attb = array( 'name' => 'enlighter-options[' . $optionName . ']', 'id' => 'enlighter-' . $optionName, 'type' => 'checkbox', 'value' => '1' ); // option selected ? if ($this->_config[$optionName]){ $attb['checked'] = 'checked'; } // generate tag, escape attributes echo HtmlUtil::generateTag('input', $attb, true); // add slider element echo HtmlUtil::generateTag('span', array( 'class' => 'enlighter-ui-slider' ), false); // add label text ? if (isset($options['label'])){ echo HtmlUtil::generateTag('span', array( 'class' => 'enlighter-label-text' ), true, esc_html($options['label'])); } // close label echo ''; // close setting block $this->settingsFooter($options); } // Generates a input-form public function displayInput($title, $optionName, $options = array()){ // open setting block $this->settingsHeader($optionName, $title, 'input'); // wrap into label echo HtmlUtil::generateTag('label', array( 'for' => 'enlighter-' . $optionName ), false); // element attributes $attb = array( 'name' => 'enlighter-options[' . $optionName . ']', 'id' => 'enlighter-' . $optionName, 'type' => 'text', 'title' => $title, 'value' => $this->_config[$optionName], 'class' => (isset($options['cssClass']) ? $options['cssClass'] : ''), 'placeholder' => (isset($options['placeholder']) ? $options['placeholder'] : '') ); // generate tag, escape attributes echo HtmlUtil::generateTag('input', $attb, true); // add label text ? if (isset($options['label'])){ echo HtmlUtil::generateTag('span', array( 'class' => 'enlighter-label-text' ), true, esc_html($options['label'])); } // close label echo ''; // close setting block $this->settingsFooter($options); } private function settingsHeader($optionName, $title, $type='input'){ echo ''; echo '
', esc_html($title), '
'; } private function settingsFooter($options = array()){ // show description ? if (isset($options['description']) && !empty($options['description'])){ echo '
'; echo esc_html($options['description']); // read-more link available ? if (isset($options['readmore'])){ echo ' ', HtmlUtil::generateTag('a', array( 'href' => $options['readmore'], 'title' => 'Read More', 'target' => '_blank' ), true, 'Read More'); } echo '
'; } // close setting block, close input block echo '
', "\n"; } }