phpDocumentor

ThemeWriter
in package
implements ThemeWriterInterface

Class ThemeWriter publish theme and create cache and compile template 5.55 s publish theme and compile template 3.62 s compile template 2.63, 2.78, 2.69, normal 0.676s

Interfaces, Classes and Traits

ThemeWriterInterface
Interface ThemeWriterInterface

Table of Contents

FILE_IS_SCRIPT_OR_SHEET_PATTERN  = '#\.(css|js)$#i'
HTML_SYSTEM_DIRECTORY  = 'html/system'
JS_SYSTEM_DIRECTORY  = 'javascripts/system'
SETTINGS_FILENAME  = 'settings.json'
UNMINIFIED_FILE_NAME_PATTERN  = '#(\.min)?\.(css|js)$#i'
$filesystem  : FilesystemAdapter
$shopSource  : string
$sourceThemeId  : ThemeId
$themeExtensionFiles  : array<string|int, mixed>
$themeSettingsFactory  : ThemeSettingsDataFactory
__construct()  : mixed
ThemeWriter constructor.
getPaths()  : array<string|int, mixed>
save()  : void
Saves the given them to the destination.
_appendFileContent()  : void
_applyActiveThemeVariants()  : bool|CustomThemeCopyResponse
_applyGxModulesCustomOverloads()  : void
_applyHtmlOverloads()  : bool|CustomThemeCopyResponse
_chmod()  : void
_copyBaseThemeFiles()  : CustomThemeCopyResponse
_copyCustomHtmlDirectory()  : bool|CustomThemeCopyResponse|mixed
_copyCustomJsDirectory()  : void
_copyCustomStylesDirectory()  : void
_copyFile()  : void
_copyGxModulesExtensionsForTheme()  : bool|CustomThemeCopyResponse
_copyMainThemeDirectory()  : void
_copyMainThemeFile()  : void
_copyOrReplaceFile()  : void
_copyOrReplaceThemeFile()  : void
_copySettingsJson()  : void
_copyStyleEditThemeDirectory()  : void
_copyThemeDirectory()  : void
_copyThemeFontsDirectory()  : void
_copyThemeImagesDirectory()  : void
_copyThemeJson()  : void
_duplicateFilesThatHaveNoMatchingMinOrSourceFile()  : void
Creates a duplicate of a file with .min if only the source file exists or a file without .min if only the .min file exists
_endsWith()  : bool
_extendHtmlFile()  : mixed
_findFilesThatHaveNoMatchingMinOrSourceFile()  : void
Checks the $themeDirectoryRoot (/public/theme) for files that have no matching source or .min file
_findScriptsAndSheetsInDirectory()  : array<string|int, string>
_getRelative()  : mixed
_getRelativeFromDir()  : string
_getRelativeFromFile()  : string
_loadActiveVariants()  : ConfigurationCollection
_moveJsFromCustomRootDirectoryToCustomGlobalDirectory()  : string
Modifies the path if a file would be placed inside the root of the custom directory. The file will be moved inside the global directory of system directory
_replaceCustomInPath()  : string
_saveMainTheme()  : void
_saveTheme()  : bool|CustomThemeCopyResponse|mixed
_saveThemeStructure()  : void
_stringAfter()  : bool|string
_stringReplaceFirst()  : string
recursiveChmod()  : void

Constants

FILE_IS_SCRIPT_OR_SHEET_PATTERN

protected mixed FILE_IS_SCRIPT_OR_SHEET_PATTERN = '#\.(css|js)$#i'

HTML_SYSTEM_DIRECTORY

protected mixed HTML_SYSTEM_DIRECTORY = 'html/system'

JS_SYSTEM_DIRECTORY

protected mixed JS_SYSTEM_DIRECTORY = 'javascripts/system'

SETTINGS_FILENAME

protected mixed SETTINGS_FILENAME = 'settings.json'

UNMINIFIED_FILE_NAME_PATTERN

protected mixed UNMINIFIED_FILE_NAME_PATTERN = '#(\.min)?\.(css|js)$#i'

Properties

$themeExtensionFiles

protected array<string|int, mixed> $themeExtensionFiles

$themeSettingsFactory

private ThemeSettingsDataFactory $themeSettingsFactory

Methods

__construct()

ThemeWriter constructor.

public __construct(FilesystemAdapter $filesystem, ExistingDirectory $shopSource, array<string|int, mixed> $themeExtensionFiles, ThemeSettingsDataFactory $themeSettingsFactory) : mixed
Parameters
$filesystem : FilesystemAdapter
$shopSource : ExistingDirectory
$themeExtensionFiles : array<string|int, mixed>
$themeSettingsFactory : ThemeSettingsDataFactory
Return values
mixed

_appendFileContent()

protected _appendFileContent( $destinationFile,  $sourceFile) : void
Parameters
$destinationFile :
$sourceFile :
Return values
void

_chmod()

protected _chmod(string $path[, int $mode = 0777 ]) : void
Parameters
$path : string
$mode : int = 0777
Return values
void

_copyFile()

protected _copyFile(string $sourceFile, string $destinationFile) : void
Parameters
$sourceFile : string
$destinationFile : string
Return values
void

_copyOrReplaceFile()

protected _copyOrReplaceFile(string $sourceFile,  $destinationFile) : void
Parameters
$sourceFile : string
$destinationFile :
Return values
void

_duplicateFilesThatHaveNoMatchingMinOrSourceFile()

Creates a duplicate of a file with .min if only the source file exists or a file without .min if only the .min file exists

protected _duplicateFilesThatHaveNoMatchingMinOrSourceFile(array<string|int, string> $files) : void
Parameters
$files : array<string|int, string>
Return values
void

_endsWith()

protected _endsWith( $haystack,  $needle) : bool
Parameters
$haystack :
$needle :
Return values
bool

_extendHtmlFile()

protected _extendHtmlFile( $sourceFile,  $destinationFile,  $suffix) : mixed
Parameters
$sourceFile :
$destinationFile :
$suffix :
Tags
throws
FileNotFoundException
Return values
mixed

_findFilesThatHaveNoMatchingMinOrSourceFile()

Checks the $themeDirectoryRoot (/public/theme) for files that have no matching source or .min file

protected _findFilesThatHaveNoMatchingMinOrSourceFile(ThemeDirectoryRootInterface $themeDirectoryRoot) : void
Parameters
$themeDirectoryRoot : ThemeDirectoryRootInterface
Return values
void

_findScriptsAndSheetsInDirectory()

protected _findScriptsAndSheetsInDirectory(StringType $directory) : array<string|int, string>
Parameters
$directory : StringType
Return values
array<string|int, string>

_getRelativeFromDir()

protected _getRelativeFromDir( $file, string $dir) : string
Parameters
$file :
$dir : string
Return values
string

_moveJsFromCustomRootDirectoryToCustomGlobalDirectory()

Modifies the path if a file would be placed inside the root of the custom directory. The file will be moved inside the global directory of system directory

protected _moveJsFromCustomRootDirectoryToCustomGlobalDirectory(string $path, string $source) : string

This method is only called for child themes

Parameters
$path : string
$source : string
Return values
string

mixed

_replaceCustomInPath()

protected _replaceCustomInPath(string $path) : string
Parameters
$path : string
Return values
string

_stringAfter()

protected _stringAfter( $searchFor,  $subject) : bool|string
Parameters
$searchFor :
$subject :
Return values
bool|string

_stringReplaceFirst()

protected _stringReplaceFirst( $search,  $replace,  $subject) : string
Parameters
$search :
$replace :
$subject :
Return values
string

recursiveChmod()

protected recursiveChmod(string $path[, int $mode = 0777 ]) : void
Parameters
$path : string
$mode : int = 0777
Return values
void

Search results