PluginProbe
Packeta / 2.1
Packeta v2.1
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / src / Packetery / Module / Options / FlagManager / FeatureFlagNotice.php

FeatureFlagNotice.php in Packeta 2.1, at src/Packetery/Module/Options/FlagManager/FeatureFlagNotice.php

91 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Class FeatureFlagNotice
4 *
5 * @package Packetery
6 */
7
8 declare( strict_types=1 );
9
10 namespace Packetery\Module\Options\FlagManager;
11
12 use Packetery\Latte\Engine;
13 use Packetery\Module\Framework\WpAdapter;
14 use Packetery\Module\ModuleHelper;
15 use Packetery\Module\Plugin;
16
17 /**
18 * Class FeatureFlagNotice
19 *
20 * @package Packetery
21 */
22 class FeatureFlagNotice {
23
24 public const ACTION_HIDE_SPLIT_MESSAGE = 'dismiss_split_message';
25
26 /**
27 * Latte engine.
28 *
29 * @var Engine
30 */
31 private $latteEngine;
32
33 /**
34 * ModuleHelper.
35 *
36 * @var ModuleHelper
37 */
38 private $moduleHelper;
39
40 /**
41 * WP adapter.
42 *
43 * @var WpAdapter
44 */
45 private $wpAdapter;
46
47 /**
48 * Constructor.
49 *
50 * @param Engine $latteEngine Latte engine.
51 * @param ModuleHelper $moduleHelper ModuleHelper.
52 * @param WpAdapter $wpAdapter WP adapter.
53 */
54 public function __construct(
55 Engine $latteEngine,
56 ModuleHelper $moduleHelper,
57 WpAdapter $wpAdapter
58 ) {
59 $this->latteEngine = $latteEngine;
60 $this->moduleHelper = $moduleHelper;
61 $this->wpAdapter = $wpAdapter;
62 }
63
64 /**
65 * Print split activation notice.
66 *
67 * @return void
68 */
69 public function renderSplitActivationNotice(): void {
70 $dismissUrl = $this->wpAdapter->addQueryArg( [ Plugin::PARAM_PACKETERY_ACTION => self::ACTION_HIDE_SPLIT_MESSAGE ] );
71 $this->latteEngine->render(
72 PACKETERY_PLUGIN_DIR . '/template/admin-notice.latte',
73 [
74 'message' => [
75 'type' => 'warning',
76 'escape' => false,
77 'message' => sprintf(
78 // translators: 1: documentation link start 2: link end 3: dismiss link start 4: link end.
79 __(
80 'We have just enabled new options for setting Packeta pickup points. You can now choose a different price for Z-Box and pickup points in the carrier settings. More information can be found in %1$sthe plugin documentation%2$s. %3$sDismiss this message%4$s',
81 'packeta'
82 ),
83 ...$this->moduleHelper->createLinkParts( 'https://github.com/Zasilkovna/WooCommerce/wiki', '_blank' ),
84 ...$this->moduleHelper->createLinkParts( $dismissUrl, null, 'button button-primary' )
85 ),
86 ],
87 ]
88 );
89 }
90 }
91