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

Abstract notion of AMP Actions #725

Merged
merged 9 commits into from
Aug 18, 2017

Conversation

amedina
Copy link
Member

@amedina amedina commented Jul 5, 2017

This PR adds an AMP Actions class hierarchy to differentiate between the actions applied in paired mode vs. canonical mode (coming up), and also between different content types such as posts, pages (coming up), etc.

@amedina amedina requested a review from mjangda July 5, 2017 20:59

require_once ( AMP__DIR__ . '/includes/actions/class-amp-actions.php' );

class AMP_Frontend_Actions extends AMP_Actions {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this class needs to extend AMP_Actions since it won't use any of the abstract class' methods.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree. Made it standalone.


class AMP_Frontend_Actions extends AMP_Actions {

public static function register_frontend_actions_filter() {
Copy link
Contributor

Choose a reason for hiding this comment

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

For consistency, we should name this register as well (or register_hooks if we want to be more descriptive)

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree; register_hooks() is more descriptive.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

add_action( 'wp_head', 'AMP_Frontend_Actions::amp_frontend_add_canonical' );
}

public static function amp_frontend_add_canonical() {
Copy link
Contributor

Choose a reason for hiding this comment

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

We can remove the amp_frontend_ prefix

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@amedina amedina changed the title Abstract notion o AMP of Actions Abstract notion of AMP Actions Jul 14, 2017
Copy link
Contributor

@mjangda mjangda left a comment

Choose a reason for hiding this comment

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

Spotted two very minor spacing issues.

Also minor, but the only other thing I wanted to flag is that we're not actually using the inheritance/base classes right now so maybe better to leave them out in this PR and introduce them when we actually start to use it. If you have other PRs ready or pending that rely on this, then okay to leave.

amp.php Outdated
@@ -21,6 +21,9 @@
require_once( AMP__DIR__ . '/includes/settings/class-amp-customizer-settings.php' );
require_once( AMP__DIR__ . '/includes/settings/class-amp-customizer-design-settings.php' );

require_once ( AMP__DIR__ . '/includes/actions/class-amp-frontend-actions.php' );
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: spacing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

<?php
// Callbacks for adding AMP-related things to the main theme

require_once ( AMP__DIR__ . '/includes/actions/class-amp-actions.php' );
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: spacing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed.

@amedina amedina added Enhancement New feature or improvement of an existing one Task Tasks which do not involve engineering labels Aug 17, 2017
@amedina amedina self-assigned this Aug 17, 2017
@amedina amedina merged commit c5237e6 into master Aug 18, 2017
@mjangda mjangda deleted the amedina/add-amp-actions-class-hierarchy branch August 23, 2017 05:08
}

public static function add_canonical() {
if ( false === apply_filters( 'add_canonical_link', true ) ) {
Copy link
Member

Choose a reason for hiding this comment

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

This change here renamed the filter from amp_frontend_show_canonical to add_canonical_link. This needs to be reverted. I think this needs to be reverted.

westonruter added a commit that referenced this pull request Jan 13, 2018
…ns-class-hierarchy"

This reverts commit c5237e6, reversing
changes made to 41af096.

Fixes merge conflicts introduced by #810 and #828.
westonruter added a commit that referenced this pull request Jan 13, 2018
…ns-class-hierarchy"

This reverts commit c5237e6, reversing
changes made to 41af096.

Fixes merge conflicts introduced by #810 and #828.
westonruter added a commit that referenced this pull request Jan 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or improvement of an existing one Task Tasks which do not involve engineering
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants