/** * Displays fields, opens and closes tabs inside of the template. */ public function display_fields() { # Don't do a thing if there are no fields if (!$this->fields) { return; } # Open a standard table if there are no tabs, at least in the beginning if (is_a($this->fields[0], 'UF_Field')) { echo '<table class="form-table">'; } # Cycle through fields, display tabs, etc. foreach ($this->fields as $i => $field) { if (is_a($field, 'UF_Field')) { $field->display(); } elseif ($field['item'] == 'tab_start') { UF_Tabs::tab_start($field); } elseif ($field['item'] == 'tab_end') { UF_Tabs::tab_end(); } } # If the last item is a field, we are not in tabs. Close the list. if (is_a($field, 'UF_Field')) { echo '</table>'; } }
/** * Displays the content of the meta box * * @param object $post The post object */ public function display($post, $sub_template = '') { global $ultimatefields; # Now that the post is known, set it as a target for the datastore if (method_exists($this->datastore, 'set_post')) { # Only happens for post meta datastores $this->datastore->set_post($post->ID); } # Spread the datastore through all fields and check their IDs foreach ($this->fields as $field) { if (is_a($field, 'UF_Field') && !$field->get_datastore() && $this->datastore->check_field_id($field->get_id())) { $field->set_datastore($this->datastore); } } # If there is an unclosed tab, close it if ($this->tab_open || $this->tabs_open) { $this->end_tab(); } # If there is an unclosed tabs group, close it if ($this->tabs_open) { $this->fields[] = array('item' => 'tabs_end'); } # Prepare tabs include_once $ultimatefields->themes->path('container/tabs', 'postmeta'); # Prepare tabs nav links if available $tab_links = UF_Tabs::links($this->tabs); # Get the template if (!is_string($sub_template)) { $sub_template = ''; } include $ultimatefields->themes->path('container/post-meta', $sub_template); # After the template itself, the field-to-field dependencies are shown $this->output_dependencies(); # After the container, some additional items might be needed do_action('uf_after_container'); }
/** * Displays the container */ public function display() { global $ultimatefields; # Close open tabs if needed if ($this->tab_open || $this->tabs_open) { $this->end_tab(); } # Get tab's functionality include_once $ultimatefields->themes->path('container/tabs'); # Prepare the standard title $title = wp_kses_post($this->page_title ? $this->page_title : $this->title); # Prepare tabs nav links if available $links = UF_Tabs::links($this->tabs); # Include the template itself include $ultimatefields->themes->path('container/options-page'); # Do stuff after the container if needed do_action('uf_after_container'); # Output the needed dependencies for the container. $this->output_dependencies(); }