Skip to content

Commit

Permalink
Issue #20 - actually implement taxonomies_are_rest
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbingwide committed Mar 27, 2018
1 parent 1e9603b commit 85ad272
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions opinions/class-oik-block-type-opinions.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,23 @@ public function can_edit_post_type() {
}

/**
* @TODO All the taxonomies need to be 'show_in_rest' for the Block editor to be available
* All the taxonomies need to be 'show_in_rest' for the Block editor to be available
*
* @TODO This routine stops checking when it finds one taxonomy that is not show in rest.
*
*/
public function taxonomies_are_rest() {
// foreach ( taxonomy )
if ( true ) {
return new oik_block_editor_opinion( 'A', false, 'T', "Taxonomy is show_in_rest" );
} else {
return new oik_block_editor_opinion( 'C', true, 'T', "Taxonomy is not show_in_rest" );
$taxonomies = get_object_taxonomies( $this->post_type );
foreach ( $taxonomies as $taxonomy ) {
$taxonomy_object = get_taxonomy( $taxonomy );
if ( !( $taxonomy_object->show_in_rest) ) {
return new oik_block_editor_opinion( 'C', true, 'T', sprintf( 'Taxonomy %1$s is not show_in_rest', $taxonomy ) );
}
}
return new oik_block_editor_opinion( 'A', false, 'T', "Taxonomies are show_in_rest" );
}




}

0 comments on commit 85ad272

Please sign in to comment.