/** * Renders content block fields * @param string $tab The tab to render the fields for * @since 0.1.0 */ function pootlepb_block_dialog_fields_output($tab = null) { //Content block panel fields $fields = pootlepb_block_styling_fields(); //Prioritize array pootlepb_prioritize_array($fields); foreach ($fields as $field) { $key = $field['id']; if (!empty($tab)) { if ($tab != $field['tab']) { continue; } } //Output html field if ('html' == $field['type']) { echo $field['name']; continue; } echo "<div class='field field-" . $key . " field_type-" . $field['type'] . "'>"; echo '<label>' . esc_html($field['name']) . '</label>'; echo '<span>'; pootlepb_render_content_block_field($key, $field); echo '</span>'; if (isset($field['help-text'])) { echo '<span class="dashicons dashicons-editor-help tooltip" data-tooltip="' . esc_html($field['help-text']) . '"></span>'; } echo '</div>'; } }
public function post_display_field($key, $field) { $field['type'] = 'select'; $field['options'] = array(); for ($i = 1; $i < 5; $i++) { $field['options'][$i] = $i; } pootlepb_render_content_block_field($key . '-across', $field); echo ' across by '; for ($i = 5; $i < 21; $i++) { $field['options'][$i] = $i; } pootlepb_render_content_block_field($key . '-down', $field); echo ' down'; }
protected function output_terms_select($taxonomy, $key, $field, $label) { $field['type'] = 'multi-select'; $field['placeholder'] = 'Choose Some ' . $label . '...'; $field['options'] = array(); $terms = get_terms($taxonomy); if (!$terms || $terms instanceof WP_Error) { echo '<p>No ' . $label . ' found!</p></span>'; return; } foreach ($terms as $term) { $field['options'][$term->term_id] = $term->name; } pootlepb_render_content_block_field($key, $field); }