Skip to content
Snippets Groups Projects
Commit 8301c2a1 authored by Grzegorz Rola's avatar Grzegorz Rola
Browse files

feature(petition): added text petition

parent 6b5cd597
No related branches found
No related tags found
1 merge request!1feature(petition): added text petition
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
......@@ -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';
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment