Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
messengermenu.php
1<?php
2
4
6{
7
8 const BUTTON_TEXT_RESERVE = 'Reserve';
9 const BUTTON_TEXT_BOOK = 'Book Now';
10 const BUTTON_TEXT_BUY = 'Buy Now';
11
12 private static function checkButtonText($value) : bool
13 {
14 return array_key_exists('cta_button_text',$value) && in_array($value['cta_button_text'],[
15 static::BUTTON_TEXT_BOOK,
16 static::BUTTON_TEXT_RESERVE,
17 static::BUTTON_TEXT_BUY
18 ]);
19
20 }
21 private static function checkUrl($value) : bool
22 {
23 return array_key_exists('cta_button_url',$value) &&
24 is_string($value['cta_button_url']) &&
25 preg_match(self::URL_PATTERN,$value['cta_button_url']);
26 }
27
28 protected static function checkValueFields($value): bool
29 {
30 return static::checkButtonText($value) && static::checkUrl($value);
31 }
32
36 static function available(): bool
37 {
38 return true;
39 }
40
44 static function required(): bool
45 {
46 return false;
47 }
48 protected static function getFields() : array
49 {
50 return array_merge(parent::getFields(),['cta_button_url','cta_button_text']);
51 }
52}