PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.0
YayMail – WooCommerce Email Customizer v4.4.0
4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 3.4.2 3.4.3 All 55 releases
yaymail / src / TemplatePatterns / SectionTemplateService.php

SectionTemplateService.php in YayMail – WooCommerce Email Customizer 4.4.0, at src/TemplatePatterns/SectionTemplateService.php

52 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace YayMail\TemplatePatterns;
3
4 use YayMail\Abstracts\BasePattern;
5 use YayMail\Abstracts\BaseSectionTemplate;
6 use YayMail\Utils\SingletonTrait;
7
8 /**
9 * Class SectionTemplateService
10 */
11 class SectionTemplateService {
12
13 use SingletonTrait;
14
15 protected $sections = [];
16
17 /**
18 * @param BaseSectionTemplate $section_template_instance SectionTemplate object
19 */
20 public function register( BaseSectionTemplate $section_template_instance ) {
21 if ( ! $section_template_instance instanceof BaseSectionTemplate ) {
22 return;
23 }
24
25 $registered_sections = array_map(
26 function( $item ) {
27 return $item->get_type();
28 },
29 $this->sections
30 );
31
32 if ( in_array( $section_template_instance->get_type(), $registered_sections, true ) ) {
33 return;
34 }
35
36 $this->sections[] = $section_template_instance;
37 }
38
39 public function get_list() {
40 return $this->sections;
41 }
42
43 public function get_list_data() {
44 return array_map(
45 function( BaseSectionTemplate $item ) {
46 return $item->get_raw_data();
47 },
48 $this->sections
49 );
50 }
51 }
52