| @@ 191-205 (lines=15) @@ | ||
| 188 | * |
|
| 189 | * @return array<string> |
|
| 190 | */ |
|
| 191 | public function get_taxonomy_visibility() { |
|
| 192 | $all_taxonomies = get_taxonomies(); |
|
| 193 | $evaluated_collection = $this->condition_collection->evaluate( array( 'term_taxonomy' ), true, array(), true ); |
|
| 194 | ||
| 195 | $shown_on = array(); |
|
| 196 | foreach ( $all_taxonomies as $taxonomy ) { |
|
| 197 | $environment = array( |
|
| 198 | 'taxonomy' => $taxonomy, |
|
| 199 | ); |
|
| 200 | if ( $evaluated_collection->is_fulfilled( $environment ) ) { |
|
| 201 | $shown_on[] = $taxonomy; |
|
| 202 | } |
|
| 203 | } |
|
| 204 | return $shown_on; |
|
| 205 | } |
|
| 206 | ||
| 207 | /** |
|
| 208 | * Show the container only on terms from the specified taxonomies. |
|
| @@ 265-279 (lines=15) @@ | ||
| 262 | * |
|
| 263 | * @return array<string> |
|
| 264 | */ |
|
| 265 | public function get_post_type_visibility() { |
|
| 266 | $all_post_types = get_post_types(); |
|
| 267 | $evaluated_collection = $this->condition_collection->evaluate( array( 'post_type' ), true, array(), true ); |
|
| 268 | ||
| 269 | $shown_on = array(); |
|
| 270 | foreach ( $all_post_types as $post_type ) { |
|
| 271 | $environment = array( |
|
| 272 | 'post_type' => $post_type, |
|
| 273 | ); |
|
| 274 | if ( $evaluated_collection->is_fulfilled( $environment ) ) { |
|
| 275 | $shown_on[] = $post_type; |
|
| 276 | } |
|
| 277 | } |
|
| 278 | return $shown_on; |
|
| 279 | } |
|
| 280 | ||
| 281 | /** |
|
| 282 | * COMMON USAGE METHODS |
|