Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

[bugfix] calling get_article_style to apply the style filter #870

Merged
merged 3 commits into from
Feb 1, 2018

Conversation

vkama
Copy link
Collaborator

@vkama vkama commented Jan 31, 2018

This PR fixes #864

It now correctly applies the filter style

Copy link
Collaborator

@everton-rosario everton-rosario left a comment

Choose a reason for hiding this comment

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

Check inline comments

@@ -991,6 +991,10 @@ public function set_appearance_from_settings() {
$this->instant_article->withStyle( 'default' );
}

if (has_filter('instant_articles_style')) {
Copy link
Collaborator

@everton-rosario everton-rosario Feb 1, 2018

Choose a reason for hiding this comment

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

Its better to remove the method get_article_style() and call inline the apply_filters.

Also add a documentation block before this method call apply_filters

    /**
    * Apply the default filter 'instant_articles_style' for the instant article.
    *
    * @since 4.0.6
    * @param string                           $template                     Path to the current (default) template.
    * @param Instant_Article_Post    $instant_article_post   The instant article post.
    */
    $article_style = apply_filters( 'instant_articles_style', 'default', $this );
    if ( $article_style !== null && !Type::isTextEmpty( $article_style ) ) {
        $instant_article->withStyle( $article_style );
    }

@vkama vkama added this to the 4.0.7 milestone Feb 1, 2018
Copy link
Collaborator

@everton-rosario everton-rosario left a comment

Choose a reason for hiding this comment

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

👍
🚢 IT

@vkama vkama merged commit e14eb38 into master Feb 1, 2018
@vkama vkama deleted the style_filter branch February 1, 2018 18:16
@vkama vkama restored the style_filter branch February 7, 2018 13:01
@vkama vkama deleted the style_filter branch February 7, 2018 13:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_article_style() method not implemented in class-instant-articles-post.php
2 participants