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

@westonruter westonruter added this to the v1.0 milestone Sep 12, 2018
@westonruter westonruter force-pushed the add/invalid-url-edit-link branch from 97dfd89 to 3a4d574 Sep 12, 2018
* 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 force-pushed the add/invalid-url-edit-link branch from 3a4d574 to 93cb6ed Sep 13, 2018
@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
@westonruter westonruter requested a review from kienstra Sep 13, 2018
Copy link
Contributor

@kienstra kienstra left a comment

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

@kienstra kienstra Sep 13, 2018

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

edit-term-link

@kienstra
Copy link
Contributor

@kienstra kienstra commented Sep 13, 2018

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
2 checks passed
@westonruter westonruter deleted the add/invalid-url-edit-link branch Sep 13, 2018
$validity['url'],
array_merge(
array(
'invalid_url_post' => $post,
Copy link
Member Author

@westonruter westonruter Sep 14, 2018

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
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants