From 92000edc74f1a2b3eae5d589367bfa64b2738dce Mon Sep 17 00:00:00 2001 From: madcap99 Date: Wed, 25 Jul 2018 20:08:46 +0300 Subject: [PATCH 1/4] add support for richedit type (TinyMCE) --- README.md | 12 +++++++ custom-controls/richedit.php | 68 ++++++++++++++++++++++++++++++++++++ customizer-library.php | 3 ++ extensions/interface.php | 9 +++++ 4 files changed, 92 insertions(+) create mode 100644 custom-controls/richedit.php diff --git a/README.md b/README.md index 0a5b54f..2b47386 100755 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ The Customizer Library currently supports these options: * Range * Textarea * Select (Typography) +* Richedit (TinyMCE) ### Sections @@ -254,6 +255,17 @@ $options['example-content'] = array( ); ~~~ +### Richedit + +~~~php +$options['example-richedit'] = array( + 'id' => 'example-richedit', + 'label' => __( 'Example richedit', 'textdomain' ), + 'section' => $section, + 'type' => 'richedit' +); +~~~ + ### Pass $options to Customizer Library After all the options and sections are defined, load them with the Customizer Library: diff --git a/custom-controls/richedit.php b/custom-controls/richedit.php new file mode 100644 index 0000000..8cbb303 --- /dev/null +++ b/custom-controls/richedit.php @@ -0,0 +1,68 @@ +value(); + ?> + + add_control( + new WP_Customize_Richedit_Control( + $wp_customize, $option['id'], $option + ) + ); + break; } From 57ac274803e1f43c607f6963aec4511990ec4bda Mon Sep 17 00:00:00 2001 From: madcap99 Date: Wed, 25 Jul 2018 21:01:51 +0300 Subject: [PATCH 2/4] add support for selective_refresh (add blue pencil in customizer) --- extensions/interface.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/extensions/interface.php b/extensions/interface.php index a0a418a..ee32424 100755 --- a/extensions/interface.php +++ b/extensions/interface.php @@ -178,6 +178,14 @@ function customizer_library_register( $wp_customize ) { break; } + + if (!empty($option['selector'])) { + $wp_customize->selective_refresh->add_partial( $option['id'], array( + 'selector' => $option['selector'], + 'container_inclusive' => isset($option['container_inclusive'])?$option['container_inclusive']:true, + ) ); + + } } } } From 480f2b8e0e67d1d861ab31f91d05e9f0866aff5b Mon Sep 17 00:00:00 2001 From: madcap99 Date: Thu, 26 Jul 2018 16:17:13 +0300 Subject: [PATCH 3/4] add section advantages --- extensions/interface.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/extensions/interface.php b/extensions/interface.php index ee32424..da3524e 100755 --- a/extensions/interface.php +++ b/extensions/interface.php @@ -40,7 +40,15 @@ function customizer_library_register( $wp_customize ) { $loop = 0; // Loops through each of the options - foreach ( $options as $option ) { + foreach ( $options as $id => $option ) { + + if (!isset($option['id'])) { + $option['id'] = $id; + } + + if (!isset($option['type'])) { + $option['type'] = 'text'; + } // Set blank description if one isn't set if ( ! isset( $option['description'] ) ) { From 2e2f4c10a4abfe3e39158a2482124c399bb81151 Mon Sep 17 00:00:00 2001 From: madcap99 Date: Fri, 27 Jul 2018 00:13:14 +0300 Subject: [PATCH 4/4] add image_gallery from plugin customize-image-gallery-control --- extensions/interface.php | 1 + 1 file changed, 1 insertion(+) diff --git a/extensions/interface.php b/extensions/interface.php index da3524e..a299136 100755 --- a/extensions/interface.php +++ b/extensions/interface.php @@ -87,6 +87,7 @@ function customizer_library_register( $wp_customize ) { case 'checkbox': case 'range': case 'dropdown-pages': + case 'image_gallery': $wp_customize->add_control( $option['id'], $option