# yaymail/4.3.2/src/TemplatePatterns/SectionTemplateService.php

YayMail – WooCommerce Email Customizer, version 4.3.2. 52 lines.

- Page: https://pluginprobe.com/plugins/yaymail/4.3.2/code/src/TemplatePatterns/SectionTemplateService.php
- Raw: https://pluginprobe.com/plugins/yaymail/4.3.2/raw/src/TemplatePatterns/SectionTemplateService.php
- Modified: 2025-12-17T13:01:26+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/yaymail/4.3.2/code/src/TemplatePatterns/SectionTemplateService.php#L10-L20`.

```php
<?php
namespace YayMail\TemplatePatterns;

use YayMail\Abstracts\BasePattern;
use YayMail\Abstracts\BaseSectionTemplate;
use YayMail\Utils\SingletonTrait;

/**
 * Class SectionTemplateService
 */
class SectionTemplateService {

    use SingletonTrait;

    protected $sections = [];

    /**
     * @param BaseSectionTemplate $section_template_instance SectionTemplate object
     */
    public function register( BaseSectionTemplate $section_template_instance ) {
        if ( ! $section_template_instance instanceof BaseSectionTemplate ) {
            return;
        }

        $registered_sections = array_map(
            function( $item ) {
                return $item->get_type();
            },
            $this->sections
        );

        if ( in_array( $section_template_instance->get_type(), $registered_sections, true ) ) {
            return;
        }

        $this->sections[] = $section_template_instance;
    }

    public function get_list() {
        return $this->sections;
    }

    public function get_list_data() {
        return array_map(
            function( BaseSectionTemplate $item ) {
                return $item->get_raw_data();
            },
            $this->sections
        );
    }
}

```
