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

Expose and store queried object for validated URL; show edit link #1426

Merged
merged 1 commit into from
Sep 13, 2018

Conversation

westonruter
Copy link
Member

@westonruter westonruter commented Sep 12, 2018

Applies the following part of the design from #1365:

image

* Update HTML comment in valudation response to be AMP_VALIDATION with results as array item.
* Include queried_object as another item in the AMP_VALIDATION, with type and id.
* Add type-specific edit links to the AMP invalid URL screen's status metabox, if user has capability to edit.
@westonruter westonruter changed the title WIP: Remember queried object when obtaining validation results; show edit post link Expose and store queried object for validated URL; show edit link Sep 13, 2018
Copy link
Contributor

@kienstra kienstra left a comment

Choose a reason for hiding this comment

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

Approved

Hi @westonruter,
This looks good.

Thanks a lot for storing the queried object. This will also help with displaying the title at the top of this screen.

<div class="misc-pub-section">
<?php
$view_label = __( 'View URL', 'amp' );
$queried_object = get_post_meta( $post->ID, '_amp_queried_object', true );
Copy link
Contributor

Choose a reason for hiding this comment

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

Great idea to store the queried object. This will also help with displaying the title, like on this design:

will-help-with-title

$view_label = $post_type_object->labels->view_item;
} elseif ( 'term' === $queried_object['type'] && get_term( $queried_object['id'] ) && taxonomy_exists( get_term( $queried_object['id'] )->taxonomy ) ) {
$taxonomy_object = get_taxonomy( get_term( $queried_object['id'] )->taxonomy );
edit_term_link( $taxonomy_object->labels->edit_item, '', $after, get_term( $queried_object['id'] ) );
Copy link
Contributor

@kienstra kienstra Sep 13, 2018

Choose a reason for hiding this comment

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

edit-term-link

@kienstra
Copy link
Contributor

This will help with #1365, so I'll merge in the develop branch to its PR once this is merged.

@westonruter westonruter merged commit 1992dbd into develop Sep 13, 2018
@westonruter westonruter deleted the add/invalid-url-edit-link branch September 13, 2018 00:47
$validity['url'],
array_merge(
array(
'invalid_url_post' => $post,
Copy link
Member Author

@westonruter westonruter Sep 14, 2018

Choose a reason for hiding this comment

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

This was bad. Fixed in #1428

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants