/** * Creates a single option * * @return void * @since 1.0 **/ public function render_option($field) { $value = isset($this->options[$field['id']]) ? $this->options[$field['id']] : null; $attr = array('name' => THEME_SHORT . '-options[' . $field['id'] . ']'); // create new field $form_field = OxygennaOptions::create_option($field, $value, $attr); $form_field->render(); if (isset($field['desc'])) { echo '</td><td>'; echo '<a class="description" title="' . $field['desc'] . '"><img src="' . OXY_TF_URI . 'assets/images/what.png" alt="Tooltip"></a>'; } }
/** * Main function called when metabox is shown in taxonomy. * * @return void **/ public function render_taxonomy_metabox($term) { foreach ($this->options['fields'] as $field) { $id = THEME_SHORT . '_' . $field['id']; $attr = array('name' => THEME_SHORT . '-options[' . $id . ']'); // we are in edit screen if (is_object($term)) { $value = get_option(THEME_SHORT . '-tax-mtb-' . $field['id'] . $term->term_id, $field['default']) == false ? $field['default'] : get_option(THEME_SHORT . '-tax-mtb-' . $field['id'] . $term->term_id, $field['default']); } else { // we are in creation screen $value = $field['default']; } // create new field $form_field = OxygennaOptions::create_option($field, $value, $attr); if ($form_field !== false) { //echo the wrappers first echo '<table class="form-table">'; echo '<th scope="row" valign="top">'; echo '<label for="' . $field['name'] . '">' . $field['name'] . '</label>'; echo '</th><td>'; $form_field->render(); if (isset($field['desc'])) { echo '<span class="description">' . $field['desc'] . '</span>'; } echo '</td></table>'; } } // create nonce wp_nonce_field($this->options['id'] . THEME_SHORT . 'taxonomy-metabox', $this->options['id'] . '-theme-taxonomy-metabox-nonce'); }
/** * Creates and renders oxygenna select and hidden field to store value (for multiple selects) inside visual composer * * @return void * @author **/ function oxy_custom_vc_oxy_select($settings, $value) { $attr = array('class' => 'vc_oxygenna_select'); if (isset($settings['oxy_option']['attr'])) { $attr = array_merge($attr, $settings['oxy_option']['attr']); } if (($value === 'null' || empty($value)) && isset($settings['oxy_option']['default'])) { $value = $settings['oxy_option']['default']; } $option = OxygennaOptions::create_option($settings['oxy_option'], $value, $attr); $output = '<div class="my_param_block">'; $output .= $option->render(false); $output .= '<input type="hidden" class="wpb_vc_param_value" name="' . $settings['oxy_option']['id'] . '" value="' . $value . '"/>'; $output .= '</div>'; return $output; }