Version 5.0.0 beta 7
This commit is contained in:
1 parent
fa2a720105
commit
54d5dcd0a0
156 files changed
+4337
-2995
No files matched your search
+51
-23
@@ -2690,11 +2690,36 @@ EOF;
|
||||
{
|
||||
$customValues = [];
|
||||
|
||||
/* Add custom settings that were added from other apps/themes */
|
||||
foreach( new ActiveRecordIterator(
|
||||
Db::i()->select( '*', 'core_theme_editor_settings', [
|
||||
[ "(setting_app not in ('" . implode( "','", IPS::$ipsApps ) . "') OR (setting_set_id != ? and setting_set_id=?) )", 0, $this->_id ]
|
||||
] ),
|
||||
Setting::class
|
||||
) as $setting )
|
||||
{
|
||||
$value = $setting->value( true );
|
||||
if( is_array( $value ) )
|
||||
{
|
||||
foreach( $value as $_k => $_v )
|
||||
{
|
||||
$customValues[ $_k . '__' . $setting->key ] = $_v;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$customValues[ $setting->key ] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if( !( $flag & static::FORCE_DEFAULT ) )
|
||||
{
|
||||
if ( ! empty( $this->css_variables ) and $variables = json_decode( $this->css_variables, true ) )
|
||||
{
|
||||
$customValues = $variables;
|
||||
foreach( $variables as $k => $v )
|
||||
{
|
||||
$customValues[ $k ] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
if( ! empty( $this->view_options ) and $layouts = json_decode( $this->view_options, true ) )
|
||||
@@ -2744,37 +2769,40 @@ EOF;
|
||||
// Regular expression to find CSS variables
|
||||
$pattern = '/--([\w-]+)\s*:\s*([^;]+)/';
|
||||
preg_match_all( $pattern, $cssData, $matches );
|
||||
$variableNames = $matches[1] ?? [];
|
||||
$variableValues = $matches[2] ?? [];
|
||||
|
||||
// Extract variable names and values from the matches
|
||||
if ( isset( $matches[1] ) and isset( $matches[2] ) )
|
||||
/* Include any editor settings that are not in the main CSS file */
|
||||
foreach( new ActiveRecordIterator(
|
||||
Db::i()->select( '*', 'core_theme_editor_settings' ),
|
||||
Setting::class
|
||||
) as $setting )
|
||||
{
|
||||
$variableNames = $matches[1];
|
||||
$variableValues = $matches[2];
|
||||
|
||||
/* Include any editor settings that are not in the main CSS file */
|
||||
foreach( new ActiveRecordIterator(
|
||||
Db::i()->select( '*', 'core_theme_editor_settings' ),
|
||||
Setting::class
|
||||
) as $setting )
|
||||
try
|
||||
{
|
||||
$variableNames[] = $setting->key;
|
||||
try
|
||||
$value = $setting->value( ( $flag & static::FORCE_DEFAULT ) );
|
||||
if( is_array( $value ) )
|
||||
{
|
||||
$variableValues[] = $setting->value( ( $flag & static::FORCE_DEFAULT ) );
|
||||
foreach( $value as $_k => $_v )
|
||||
{
|
||||
$variableNames[] = $_k . '__' . $setting->key;
|
||||
$variableValues[] = $_v;
|
||||
}
|
||||
}
|
||||
catch( InvalidArgumentException $e )
|
||||
else
|
||||
{
|
||||
Log::debug( $e, 'template_error' );
|
||||
$variableValues[] = "";
|
||||
$variableNames[] = $setting->key;
|
||||
$variableValues[] = $value;
|
||||
}
|
||||
}
|
||||
catch( InvalidArgumentException $e )
|
||||
{
|
||||
Log::debug( $e, 'template_error' );
|
||||
$variableValues[] = "";
|
||||
}
|
||||
}
|
||||
|
||||
$this->cssVariablesCached[ $flag ] = array_merge( array_combine( $variableNames, $variableValues ), $customValues );
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->cssVariablesCached[ $flag ] = [];
|
||||
}
|
||||
$this->cssVariablesCached[ $flag ] = array_merge( array_combine( $variableNames, $variableValues ), $customValues );
|
||||
}
|
||||
|
||||
return $this->cssVariablesCached[ $flag ];
|
||||
|
||||
Reference in new issue
Block a user