/** * Get collection : Taxonomies => Terms * * @param string $taxonomies Array of taxonomies * @param array $args Array of query parameters */ static function terms_of_taxonomies($taxonomies = array(), $args = array()) { $terms_of_taxonomies = $result = array(); // Get taxonomies $taxonomies = PT_CV_Values::taxonomy_list(); // Get slug list of taxonomies $taxonomies_slug = array_keys($taxonomies); foreach ($taxonomies_slug as $taxonomy_slug) { PT_CV_Values::term_of_taxonomy($taxonomy_slug, $terms_of_taxonomies, $args); } foreach ($terms_of_taxonomies as $taxonomy_slug => $terms) { $result[$taxonomy_slug] = array(array('label' => array('text' => __('Select terms', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'select', 'name' => $taxonomy_slug . '-terms[]', 'options' => $terms, 'std' => '', 'class' => apply_filters(PT_CV_PREFIX_ . 'select_term_class', 'select2'), 'multiple' => '1'))), array('label' => array('text' => __('Operator', PT_CV_TEXTDOMAIN)), 'params' => array(array('type' => 'select', 'name' => $taxonomy_slug . '-operator', 'options' => PT_CV_Values::taxonomy_operators(), 'std' => 'IN')))); } return $result; }
/** * Get collection : Taxonomies => Terms * * @param string $taxonomies Array of taxonomies * @param array $args Array of query parameters */ static function terms_of_taxonomies($taxonomies = array(), $args = array()) { $terms_of_taxonomies = $result = array(); // Get taxonomies $taxonomies = PT_CV_Values::taxonomy_list(); // Get slug list of taxonomies $taxonomies_slug = array_keys($taxonomies); foreach ($taxonomies_slug as $taxonomy_slug) { PT_CV_Values::term_of_taxonomy($taxonomy_slug, $terms_of_taxonomies, $args); } foreach ($terms_of_taxonomies as $taxonomy_slug => $terms) { $result[$taxonomy_slug] = array(array('label' => array('text' => __('Select terms', 'content-views-query-and-display-post-page')), 'params' => array(array('type' => 'select', 'name' => $taxonomy_slug . '-terms[]', 'options' => $terms, 'std' => '', 'class' => apply_filters(PT_CV_PREFIX_ . 'select_term_class', 'select2'), 'multiple' => '1'))), array('label' => array('text' => __('Operator', 'content-views-query-and-display-post-page')), 'params' => array(array('type' => 'select', 'name' => $taxonomy_slug . '-operator', 'options' => PT_CV_Values::taxonomy_operators(), 'std' => 'IN')), 'dependence' => array('taxonomy-term-info', 'as_output', '!='))); } return $result; }