From 8301c2a102a164be596a8fea505a00757e6ad220 Mon Sep 17 00:00:00 2001 From: Grzegorz Rola <grola@seostudio.pl> Date: Sun, 23 Jan 2022 12:16:08 +0100 Subject: [PATCH] feature(petition): added text petition --- src/TextPetition.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/TextPetition.php b/src/TextPetition.php index fdda3fc..661ee25 100644 --- a/src/TextPetition.php +++ b/src/TextPetition.php @@ -44,18 +44,31 @@ class TextPetition implements Hookable { /** * @param string $display_on_action * @param DisplayDecision $display_decision + * @param string $plugin_author + * @param string $plugin_title + * @param string $rating_url + * @param string $text_align */ - public function __construct( string $display_on_action, DisplayDecision $display_decision ) { + public function __construct( string $display_on_action, DisplayDecision $display_decision, string $plugin_author, string $plugin_title, string $rating_url, string $text_align = 'center' ) { $this->display_on_action = $display_on_action; $this->display_decision = $display_decision; + $this->text_align = $text_align; + $this->plugin_author = $plugin_author; + $this->plugin_title = $plugin_title; + $this->rating_url = $rating_url; } + public function hooks() { add_action( $this->display_on_action, [ $this, 'display_petition_if_should' ] ); } public function display_petition_if_should() { if ( $this->display_decision->should_display() ) { + $text_align = $this->text_align; + $plugin_author = $this->plugin_author; + $plugin_title = $this->plugin_title; + $rating_url = $this->rating_url; include __DIR__ . '/views/html-text-petition.php'; } } -- GitLab