Conversation
| break; | ||
| } | ||
|
|
||
| return '<p class="status ' . $status . '" id="status-label">' . $label . '</p>'; |
There was a problem hiding this comment.
| return '<p class="status ' . $status . '" id="status-label">' . $label . '</p>'; | |
| return '<p class="status ' . esc_attr( $status ) . '" id="status-label">' . $label . '</p>'; |
| * Default false. | ||
| * @return WP_Post|null WP_Post object for the Explanation, null otherwise. | ||
| */ | ||
| function get_explanation( $post, $published = false ) { |
| return; | ||
| } | ||
|
|
||
| $explanation = get_explanation( $post ); |
There was a problem hiding this comment.
Should call our get_explanation()?
| } | ||
|
|
||
| // Proceed only if there's an explanation for the current reference post type. | ||
| if ( ! empty( $screen->post_type ) && $explanation = get_explanation( $screen ) ) { // phpcs:ignore |
There was a problem hiding this comment.
Should call our get_explanation()?
| return $actions; | ||
| } | ||
|
|
||
| $expl = \DevHub\get_explanation( $post ); |
There was a problem hiding this comment.
Should call our get_explanation()?
| * @param int|WP_Post $post Post ID or WP_Post object. | ||
| */ | ||
| public function status_controls( $post ) { | ||
| $explanation = DevHub\get_explanation( $post ); |
There was a problem hiding this comment.
Should call our get_explanation()?
| $post_id = empty( $_REQUEST['post_id'] ) ? 0 : absint( $_REQUEST['post_id'] ); | ||
| $context = empty( $_REQUEST['context'] ) ? '' : sanitize_text_field( wp_unslash( $_REQUEST['context'] ) ); | ||
|
|
||
| if ( DevHub\get_explanation( $post_id ) ) { |
There was a problem hiding this comment.
Should call our get_explanation()?
|
|
||
| $post_id = empty( $_REQUEST['post_id'] ) ? 0 : absint( $_REQUEST['post_id'] ); | ||
|
|
||
| if ( $explanation = get_explanation( $post_id ) ) { // phpcs:ignore |
There was a problem hiding this comment.
Should call our get_explanation()?
| */ | ||
| public function handle_column_data( $column_name, $post_id ) { | ||
| if ( 'has_explanation' === $column_name ) { | ||
| if ( $explanation = get_explanation( $post_id ) ) { // phpcs:ignore |
There was a problem hiding this comment.
Should call our get_explanation()?
| * @see WP after_setup_theme action. | ||
| */ | ||
| public function after_setup_theme() { | ||
| // Remove post types registered by theme. |
There was a problem hiding this comment.
Let's add a check to see if at least $explanations is set and if the remove_action is needed here
| add_action( 'init', array( $this, 'register_post_type' ), 0 ); | ||
| add_action( 'init', array( $this, 'remove_editor_support' ), 100 ); |
There was a problem hiding this comment.
Run these right away and call the set up in the init with the other classes
| * @see WP plugins_loaded action. | ||
| */ | ||
| public function plugins_loaded() { | ||
| new Explanations(); |
There was a problem hiding this comment.
Let's move this into the init() and have Explanations::__construct() run it's init stuff right away or move those into a ::init() method that can get called
There was a problem hiding this comment.
If that doesn't work as expected, we can bail on that path and just keep it as is
Resolves #5
This PR does the following: