Skip to content

Commit 77ea83e

Browse files
committed
Use a const for the POPOVER_ID in interactive tasks
1 parent 5b0e0ad commit 77ea83e

2 files changed

Lines changed: 19 additions & 19 deletions

File tree

classes/suggested-tasks/providers/class-email-sending.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ class Email_Sending extends Tasks {
4040
*/
4141
const IS_INTERACTIVE = true;
4242

43+
/**
44+
* The popover ID.
45+
*
46+
* @var string
47+
*/
48+
const POPOVER_ID = 'sending-email';
49+
4350
/**
4451
* Whether the task is dismissable.
4552
*
@@ -54,13 +61,6 @@ class Email_Sending extends Tasks {
5461
*/
5562
protected $priority = 1;
5663

57-
/**
58-
* The popover ID.
59-
*
60-
* @var string
61-
*/
62-
protected $popover_id = 'sending-email';
63-
6464
/**
6565
* The email title.
6666
*
@@ -288,7 +288,7 @@ public function the_popover_content() {
288288
\progress_planner()->the_view(
289289
'popovers/email-sending.php',
290290
[
291-
'prpl_popover_id' => $this->popover_id,
291+
'prpl_popover_id' => static::POPOVER_ID,
292292
'prpl_provider_id' => $this->get_provider_id(),
293293
'prpl_email_subject' => $this->email_subject,
294294
'prpl_email_error' => $this->email_error,
@@ -306,7 +306,7 @@ public function the_popover_content() {
306306
* @return array
307307
*/
308308
protected function modify_injection_task_data( $task_data ) {
309-
$task_data['popover_id'] = 'prpl-popover-' . $this->popover_id;
309+
$task_data['popover_id'] = 'prpl-popover-' . static::POPOVER_ID;
310310

311311
return $task_data;
312312
}

classes/suggested-tasks/providers/class-tasks.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ abstract class Tasks implements Tasks_Interface {
5656
*/
5757
const IS_INTERACTIVE = false;
5858

59+
/**
60+
* The popover ID for interactive tasks.
61+
*
62+
* @var string
63+
*/
64+
const POPOVER_ID = '';
65+
5966
/**
6067
* Whether the task is repetitive.
6168
*
@@ -126,13 +133,6 @@ abstract class Tasks implements Tasks_Interface {
126133
*/
127134
protected $data_collector = null;
128135

129-
/**
130-
* The popover ID for interactive tasks.
131-
*
132-
* @var string
133-
*/
134-
protected $popover_id = '';
135-
136136
/**
137137
* Constructor.
138138
*
@@ -581,7 +581,7 @@ protected function transform_collector_data( array $data ): array {
581581
*/
582582
public function add_popover() {
583583
?>
584-
<div id="prpl-popover-<?php echo \esc_attr( $this->popover_id ); ?>" class="prpl-popover prpl-popover-interactive" popover>
584+
<div id="prpl-popover-<?php echo \esc_attr( static::POPOVER_ID ); ?>" class="prpl-popover prpl-popover-interactive" popover>
585585
<?php $this->the_popover_content(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
586586
</div>
587587
<?php
@@ -594,9 +594,9 @@ public function add_popover() {
594594
*/
595595
public function the_popover_content() {
596596
\progress_planner()->the_view(
597-
"popovers/{$this->popover_id}.php",
597+
'popovers/' . static::POPOVER_ID . '.php',
598598
[
599-
'prpl_popover_id' => $this->popover_id,
599+
'prpl_popover_id' => static::POPOVER_ID,
600600
'prpl_provider_id' => $this->get_provider_id(),
601601
]
602602
);

0 commit comments

Comments
 (0)