public function init() { $this->setLabel(__('Project', 'buggypress')); $this->addMultiOption('', __(' -- Select Project -- ', 'buggypress')); $projects = get_posts(array('post_type' => BuggyPress_Project::POST_TYPE, 'post_status' => 'publish', 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC', 'suppress_filters' => FALSE)); foreach ($projects as $project) { $this->addMultiOption($project->ID, get_the_title($project)); } if (isset($this->_issue)) { $this->setValue($this->_issue->get_project_id()); } }
public function render($post) { $issue = new BuggyPress_Issue($post->ID); $projects = get_posts(array('post_type' => BuggyPress_Project::POST_TYPE, 'posts_per_page' => -1, 'orderby' => 'title', 'order' => 'ASC')); $current_project = $issue->get_project_id(); include BuggyPress::plugin_path('views/admin/meta-box-issue-project.php'); }
/** * @param string $field * @return mixed */ private function get_old_value($field) { switch ($field) { case 'title': return $this->issue->get_title(); case 'description': return $this->issue->get_description(); case 'project': return $this->issue->get_project_id(); case 'assignee': return $this->issue->get_assignee_id(); case 'type': return $this->issue->get_type(); case 'status': return $this->issue->get_status(); case 'resolution': return $this->issue->get_resolution(); case 'priority': return $this->issue->get_priority(); default: return apply_filters('buggypress_issue_old_value', '', $field); } }
/** * Get the URL for a dynamic menu item * * @param string $item_slug * @return string */ private function get_menu_item_url($item_slug) { switch ($item_slug) { case 'project': return get_post_type_archive_link('project'); case 'newissue': $project = ''; if (!is_admin()) { global $wp_query; if (is_singular('issue')) { $issue = new BuggyPress_Issue(get_queried_object_id()); $project_id = $issue->get_project_id(); $project_post = get_post($project_id); $project = $project_post->post_name; } elseif ($project_query_var = get_query_var('project')) { $project = $project_query_var; } } return home_url(BuggyPress_NewIssuePage::get_path($project)); } return ''; }