PluginProbe
Depicter — Popup & Slider Builder / trunk
Depicter — Popup & Slider Builder vtrunk
4.8.1 trunk 1.0.0 1.1.0 1.1.2 1.1.4 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.5 1.3.8 1.5.0 1.5.1 1.5.2 1.5.5 1.6.0 1.6.1 1.6.2 1.7.0 All 76 releases
depicter / app / src / Rules / Condition / WordPress / IsArchive.php

IsArchive.php in Depicter — Popup & Slider Builder trunk, at app/src/Rules/Condition/WordPress/IsArchive.php

65 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Depicter\Rules\Condition\WordPress;
4
5 use Averta\Core\Utility\Arr;
6 use Depicter\Rules\Condition\Base as ConditionBase;
7
8 class IsArchive extends ConditionBase
9 {
10 /**
11 * @inheritdoc
12 */
13 public $slug = 'WordPress_IsArchive';
14
15 /**
16 * @inheritdoc
17 */
18 public $control = 'dropdown';
19
20 /**
21 * @inheritdoc
22 */
23 protected $belongsTo = 'WordPress';
24
25 /**
26 * @inheritdoc
27 */
28 public function getLabel(): ?string{
29 return __('WP Archive Page', 'depicter' );
30 }
31
32 /**
33 * @inheritDoc
34 */
35 public function getDescription(): ?string{
36 return __( 'When any type of Archive page is being displayed. Category, Tag, Author and Date based pages are all types of Archives.', 'depicter' );
37 }
38
39 /**
40 * @inheritDoc
41 */
42 public function getControlOptions(){
43 $options = parent::getControlOptions();
44
45 return Arr::merge( $options, [ 'options' => [
46 [
47 'label' => __( 'WP Archive Page', 'depicter' ),
48 'value' => true
49 ]
50 ]]);
51 }
52
53 /**
54 * @inheritdoc
55 */
56 public function check( $value = null ): bool{
57
58 $value = $value ?? $this->value;
59
60 $isIncluded = is_archive();
61
62 return $this->selectionMode === 'include' ? $isIncluded : ! $isIncluded;
63 }
64 }
65