Automattic\WooCommerce\Blocks\Utils
BlockTemplateUtils::get_template_paths()
Finds all nested template part file paths in a theme's directory.
Метод класса: BlockTemplateUtils{}
Хуков нет.
Возвращает
Массив
. $path_list A list of paths to all template part files.
Использование
$result = BlockTemplateUtils::get_template_paths( $base_directory );
- $base_directory(строка) (обязательный)
- The theme's file path.
Код BlockTemplateUtils::get_template_paths() BlockTemplateUtils::get template paths WC 8.7.0
public static function get_template_paths( $base_directory ) { $path_list = array(); if ( file_exists( $base_directory ) ) { $nested_files = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator( $base_directory ) ); $nested_html_files = new \RegexIterator( $nested_files, '/^.+\.html$/i', \RecursiveRegexIterator::GET_MATCH ); foreach ( $nested_html_files as $path => $file ) { $path_list[] = $path; } } return $path_list; }