diff --git a/components/color-scheme/styles.php b/components/color-scheme/styles.php index daf335c..9307cea 100644 --- a/components/color-scheme/styles.php +++ b/components/color-scheme/styles.php @@ -1,11 +1,51 @@ - 'color_scheme', 'label' => __('Color scheme', 'sleek_admin'), 'type' => 'group', 'sub_fields' => [ - + ...(include get_stylesheet_directory() . '/components/media/fields.php')($moduleName . '_styles_color_scheme', [ + 'additional_fields' => [ + [ + 'name' => 'light_media', + 'label' => __('Light media', 'sleek_admin'), + 'instructions' => __('Check this if the media is light. Dark text will then be used.', 'sleek_admin'), + 'message' => __('Light media', 'sleek_admin'), + 'type' => 'true_false', + 'conditional_logic' => [[[ + 'field' => '{acf_key}_' . $moduleName . '_styles_color_scheme_media_media', + 'operator' => '!=empty' + ]]] + ], + [ + 'name' => 'media_overlay', + 'label' => __('Media overlay', 'sleek_admin'), + 'instructions' => __('Check this to add an overlay to the media (if the media is light, the overlay will be light too).'), + 'message' => __('Enable media overlay', 'sleek_admin'), + 'type' => 'true_false', + 'default_value' => true, + 'conditional_logic' => [[[ + 'field' => '{acf_key}_' . $moduleName . '_styles_color_scheme_media_media', + 'operator' => '!=empty' + ]]] + ] + ] + ]), + [ + 'name' => 'bg_color', + 'label' => __('Background color'), + 'type' => 'select', + 'choices' => [ + 'transparent' => __('Transparent', 'sleek_admin'), + 'dark' => __('Dark', 'sleek_admin') + ], + 'default_value' => 'transparent', + 'conditional_logic' => [[[ + 'field' => '{acf_key}_' . $moduleName . '_styles_color_scheme_media_media', + 'operator' => '==empty' + ]]] + ] ] ] ]; diff --git a/components/color-scheme/template.php b/components/color-scheme/template.php index e69de29..1eedabe 100644 --- a/components/color-scheme/template.php +++ b/components/color-scheme/template.php @@ -0,0 +1,7 @@ + null + ], $args); +?> + +
\ No newline at end of file diff --git a/components/media/fields.php b/components/media/fields.php index 25a4e5b..079161b 100644 --- a/components/media/fields.php +++ b/components/media/fields.php @@ -1,7 +1,7 @@ null, - 'ratio' => true + 'ratio' => true, + 'additional_fields' => [] ], $args); # Main media file @@ -46,6 +46,8 @@ ])); } + $fields = array_merge($fields, $config['additional_fields']); + return [ [ 'name' => 'media', diff --git a/inc/module-class.php b/inc/module-class.php new file mode 100644 index 0000000..4f6941f --- /dev/null +++ b/inc/module-class.php @@ -0,0 +1,5 @@ +snakeName), ...(include get_stylesheet_directory() . '/components/module-header/styles.php')(), ...(include get_stylesheet_directory() . '/components/links/styles.php')() ]; diff --git a/modules/invise-example-module/template.php b/modules/invise-example-module/template.php index 0cf550c..a92b92f 100644 --- a/modules/invise-example-module/template.php +++ b/modules/invise-example-module/template.php @@ -1,4 +1,8 @@ -