| @@ 250-264 (lines=15) @@ | ||
| 247 | * |
|
| 248 | * @return array<string> |
|
| 249 | */ |
|
| 250 | public function get_post_type_visibility() { |
|
| 251 | $all_post_types = get_post_types(); |
|
| 252 | $evaluated_collection = $this->condition_collection->evaluate( array( 'post_type' ), true, array(), true ); |
|
| 253 | ||
| 254 | $shown_on = array(); |
|
| 255 | foreach ( $all_post_types as $post_type ) { |
|
| 256 | $environment = array( |
|
| 257 | 'post_type' => $post_type, |
|
| 258 | ); |
|
| 259 | if ( $evaluated_collection->is_fulfilled( $environment ) ) { |
|
| 260 | $shown_on[] = $post_type; |
|
| 261 | } |
|
| 262 | } |
|
| 263 | return $shown_on; |
|
| 264 | } |
|
| 265 | ||
| 266 | /** |
|
| 267 | * COMMON USAGE METHODS |
|
| @@ 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. |
|