public function meta_box($post, $metabox) { $connection_name = $metabox['args']['connection']; $direction = $metabox['args']['direction']; $connection = $this->connection_factory->get_connection($connection_name); $connection_args = $connection->get_args(); $selected = $direction == 'to' ? $connection->get_connected_to_objects($post->ID) : $connection->get_connected_from_objects($post->ID); $args = array('post_type' => $direction == 'to' ? $connection->to() : $connection->from(), 'selected' => $selected, 'sortable' => $connection->is_sortable($direction), 'labels' => $connection_args[$direction]['labels'], 'orderby' => $connection_args['metabox']['orderby'], 'order' => $connection_args['metabox']['order'], 'limit' => $connection_args[$direction]['limit']); $args = apply_filters("o2o_{$connection_name}_psu_args", $args, $direction); echo post_selection_ui($connection_name . '_' . $direction, $args); wp_nonce_field('set_' . $connection->get_name() . '_' . $direction . '_' . $post->ID, $connection->get_name() . '_' . $direction . '_nonce'); }
/** * Render control */ public function render_content() { $value = explode(',', $this->value()); $psu_args = array_merge(array('selected' => $value), $this->psu_args); ?> <label class="voce-customize-psu"> <span class="customize-control-title"><?php echo esc_html($this->label); ?> </span> <?php echo post_selection_ui($this->id, $psu_args); ?> </label> <?php }
static function display_callback($field, $value, $post_id) { $args = array_merge(array('id' => $field->get_input_id(), 'selected' => is_array($value) ? $value : explode(',', $value)), (array) $field->args); ?> <div class="voce-post-meta-psu-container"> <div class="label"> <?php voce_field_label_display($field); ?> </div> <div class="form-input"> <div class="widget"> <div class="widget-inside" style="display:block; border:0;"> <?php echo post_selection_ui($field->get_name(), $args); echo !empty($args['description']) ? '<br><span class="description">' . $args['description'] . '</span>' : ''; ?> </div> </div> </div> </div> <?php }