Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing variable reference in meta-box-partial-page.php #3092

Merged
merged 2 commits into from
Oct 21, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions lib/meta-box-partial-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ function gutenberg_meta_box_partial_page( $post_type, $meta_box_context ) {

global $post, $wp_meta_boxes, $hook_suffix, $current_screen, $wp_locale;

// This page should always match up with the edit action.
$action = 'edit';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If $action is always 'edit' and gutenberg_meta_box_partial_page_post_form is only ever called from here, is the 'edit' === $action even necessary? Are we expecting gutenberg_meta_box_partial_page_post_form to be called in other contexts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we expecting gutenberg_meta_box_partial_page_post_form to be called in other contexts?

I do not know. We can most likely get rid of this code then? I am fairly positive that metaboxes only ever display if the edit action is set on post.php, but that could be wrong. In this code I am setting it to be edit anyways, so it is probably best to just eliminate any of the code using action.

Copy link
Contributor Author

@BE-Webdesign BE-Webdesign Oct 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if you want to merge as is, or remove any reference to action since it should always be edit anyways.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if you want to merge as is, or remove any reference to action since it should always be edit anyways.

I'm content with either, but if we don't anticipate to need to check $action, probably best to remove.


gutenberg_meta_box_partial_page_admin_header( $hook_suffix, $current_screen, $wp_locale );

gutenberg_meta_box_partial_page_post_form( $post, $location );
gutenberg_meta_box_partial_page_post_form( $post, $location, $action );

// Handle meta box state.
$_original_meta_boxes = $wp_meta_boxes;
Expand Down Expand Up @@ -317,9 +320,6 @@ function gutenberg_meta_box_partial_page_admin_header( $hook_suffix, $current_sc
*/
$admin_body_classes = apply_filters( 'admin_body_class', '' );

// This page should always match up with the edit action.
$action = 'edit';

?>
<body class="wp-admin wp-core-ui no-js <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
<script type="text/javascript">
Expand All @@ -337,8 +337,9 @@ function gutenberg_meta_box_partial_page_admin_header( $hook_suffix, $current_sc
*
* @param WP_Post $post Current post object.
* @param string $location Metabox location: one of 'normal', 'advanced', 'side'.
* @param string $action The action taken for the post.php page.
*/
function gutenberg_meta_box_partial_page_post_form( $post, $location ) {
function gutenberg_meta_box_partial_page_post_form( $post, $location, $action ) {
$notice = false;
$form_extra = '';
if ( 'auto-draft' === $post->post_status ) {
Expand Down