private function __construct() { if (!isset($_GET['wpcf-post-type'])) { return; } Types_Helper_Placeholder::set_post_type($_GET['wpcf-post-type']); Types_Helper_Condition::set_post_type($_GET['wpcf-post-type']); $this->prepare(); }
private function __construct() { if (!isset($_GET['group_id'])) { return; } $post_types = get_post_meta($_GET['group_id'], '_wp_types_group_post_types', 'string'); $post_types = explode(',', $post_types); $post_types = array_values(array_filter($post_types)); if (count($post_types) != 1 || $post_types[0] == 'all') { return; } Types_Helper_Placeholder::set_post_type($post_types[0]); Types_Helper_Condition::set_post_type($post_types[0]); $this->prepare(); }
/** * @param $post_types * @param $headline * * @return string */ private function get_dashboard_types_table($post_types, $headline, $post_type_edit_link = true) { // documentation urls $documentation_urls = (include TYPES_DATA . '/documentation-urls.php'); // add links to use analytics Types_Helper_Url::add_urls($documentation_urls); // set analytics medium Types_Helper_Url::set_medium('dashboard'); /* messages */ $messages_files = array(TYPES_DATA . '/dashboard/table/template.php', TYPES_DATA . '/dashboard/table/archive.php', TYPES_DATA . '/dashboard/table/views.php', TYPES_DATA . '/dashboard/table/forms.php'); // add dashboard $rows = ''; foreach ($post_types as $post_type) { $info_post_type = new Types_Information_Table('types-information-table'); Types_Helper_Condition::set_post_type($post_type->get_name()); Types_Helper_Placeholder::set_post_type($post_type->get_name()); foreach ($messages_files as $message_file) { $this->load_data_to_table($message_file, $info_post_type); } $row = $this->get_twig()->render('/page/dashboard/table/tbody-row.twig', array('labels' => array('or' => __('Or...', 'types'), 'create_taxonomy' => __('Create taxonomy', 'types'), 'create_field_group' => __('Create field group', 'types'), 'no_archive_for' => __('No archive available for %s', 'types')), 'admin_url' => admin_url(), 'post_type' => $post_type, 'table' => $info_post_type, 'post_type_edit_link' => $post_type_edit_link)); Types_Helper_Placeholder::replace($row); $rows .= $row; } // table view $data_thead = (require TYPES_DATA . '/dashboard/table/head.php'); $table = $this->get_twig()->render('/page/dashboard/table.twig', array('labels' => array('headline' => $headline, 'admin' => __('WordPress admin', 'types'), 'frontend' => __('Front-end', 'types'), 'or' => __('Or...', 'types')), 'admin_url' => admin_url(), 'thead' => $data_thead, 'rows' => $rows)); return $table; }