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

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

- Page: https://pluginprobe.com/plugins/yaymail/4.3.2/code/src/TemplatePatterns/SectionTemplatesLoader.php
- Raw: https://pluginprobe.com/plugins/yaymail/4.3.2/raw/src/TemplatePatterns/SectionTemplatesLoader.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/SectionTemplatesLoader.php#L10-L20`.

```php
<?php

namespace YayMail\TemplatePatterns;

use YayMail\TemplatePatterns\SectionTemplateService;
use YayMail\Utils\SingletonTrait;

/**
 * @method static SectionTemplatesLoader get_instance()
 */
class SectionTemplatesLoader {

    use SingletonTrait;

    /**
     * @var SectionTemplateService
     */
    public $service;

    private function __construct() {

        $this->service = SectionTemplateService::get_instance();

        $dir = new \DirectoryIterator( YAYMAIL_PLUGIN_PATH . '/src/TemplatePatterns/SectionTemplates' );
        foreach ( $dir as $fileinfo ) {
            if ( ! $fileinfo->isDot() ) {
                $file_name  = $fileinfo->getFilename();
                $class_name = basename( $file_name, '.php' );
                $class      = 'YayMail\\TemplatePatterns\\SectionTemplates\\' . $class_name;
                if ( __CLASS__ === $class ) {
                    continue;
                }
                if ( class_exists( $class ) ) {
                    $this->service->register( $class::get_instance() );
                }
            }
        }

        do_action( 'yaymail_register_template_sections', $this->service );
    }
}

```
