From 09daed979e3aded864be16fde0a73daf13e64d4c Mon Sep 17 00:00:00 2001 From: Vincent Klaiber Date: Sat, 28 Oct 2023 20:06:22 +0200 Subject: [PATCH] Rename `WysiwygEditor` to `WYSIWYGEditor` --- README.md | 10 ++++++++++ examples/options-page.php | 4 ++-- examples/with-extended-cpts.php | 4 ++-- .../{WysiwygEditor.php => WYSIWYGEditor.php} | 2 +- ...wygEditorTest.php => WYSIWYGEditorTest.php} | 18 +++++++++--------- 5 files changed, 24 insertions(+), 14 deletions(-) rename src/Fields/{WysiwygEditor.php => WYSIWYGEditor.php} (98%) rename tests/Fields/{WysiwygEditorTest.php => WYSIWYGEditorTest.php} (73%) diff --git a/README.md b/README.md index 8478ac58..46f0336f 100644 --- a/README.md +++ b/README.md @@ -822,6 +822,16 @@ The `Url` class has been renamed to `URL`. +URL::make('GitHub URL') ``` +The `WysiwygEditor` class has been renamed to `WYSIWYGEditor`. + +```diff +-use Extended\ACF\Fields\WysiwygEditor; ++use Extended\ACF\Fields\WYSIWYGEditor; + +-WysiwygEditor::make('Content') ++WYSIWYGEditor::make('Content') +``` + The `defaultValue` method has been renamed to `default`. ```diff diff --git a/examples/options-page.php b/examples/options-page.php index 422e3a29..659e6fea 100644 --- a/examples/options-page.php +++ b/examples/options-page.php @@ -5,7 +5,7 @@ // https://www.advancedcustomfields.com/resources/acf_add_options_page/ use Extended\ACF\Fields\Text; -use Extended\ACF\Fields\WysiwygEditor; +use Extended\ACF\Fields\WYSIWYGEditor; use Extended\ACF\Location; acf_add_options_page([ @@ -18,7 +18,7 @@ register_extended_field_group([ 'title' => 'Cookie', 'fields' => [ - WysiwygEditor::make('Text', 'cookie_text') + WYSIWYGEditor::make('Text', 'cookie_text') ->instructions('Add the cookie disclaimer text.') ->disableMediaUpload(false) ->tabs('visual') diff --git a/examples/with-extended-cpts.php b/examples/with-extended-cpts.php index 8fa1a2ce..ec993b28 100644 --- a/examples/with-extended-cpts.php +++ b/examples/with-extended-cpts.php @@ -4,7 +4,7 @@ // and taxanomies. Please see the repository for more information: // https://github.com/johnbillion/extended-cpts -use Extended\ACF\Fields\WysiwygEditor; +use Extended\ACF\Fields\WYSIWYGEditor; use Extended\ACF\Location; register_extended_post_type('faq', [ @@ -36,7 +36,7 @@ register_extended_field_group([ 'title' => 'FAQ', 'fields' => [ - WysiwygEditor::make('Answer') + WYSIWYGEditor::make('Answer') ->instructions('Add the question answer.') ->disableMediaUpload() ->tabs('visual') diff --git a/src/Fields/WysiwygEditor.php b/src/Fields/WYSIWYGEditor.php similarity index 98% rename from src/Fields/WysiwygEditor.php rename to src/Fields/WYSIWYGEditor.php index a9e25e23..ea77d49d 100644 --- a/src/Fields/WysiwygEditor.php +++ b/src/Fields/WYSIWYGEditor.php @@ -20,7 +20,7 @@ use Extended\ACF\Fields\Settings\Wrapper; use InvalidArgumentException; -class WysiwygEditor extends Field +class WYSIWYGEditor extends Field { use ConditionalLogic; use DefaultValue; diff --git a/tests/Fields/WysiwygEditorTest.php b/tests/Fields/WYSIWYGEditorTest.php similarity index 73% rename from tests/Fields/WysiwygEditorTest.php rename to tests/Fields/WYSIWYGEditorTest.php index 170ba9c1..15b4a3aa 100644 --- a/tests/Fields/WysiwygEditorTest.php +++ b/tests/Fields/WYSIWYGEditorTest.php @@ -13,7 +13,7 @@ namespace Extended\ACF\Tests\Fields; -use Extended\ACF\Fields\WysiwygEditor; +use Extended\ACF\Fields\WYSIWYGEditor; use Extended\ACF\Tests\Fields\Settings\ConditionalLogic; use Extended\ACF\Tests\Fields\Settings\DefaultValue; use Extended\ACF\Tests\Fields\Settings\Instructions; @@ -21,7 +21,7 @@ use Extended\ACF\Tests\Fields\Settings\Wrapper; use InvalidArgumentException; -class WysiwygEditorTest extends FieldTestCase +class WYSIWYGEditorTest extends FieldTestCase { use ConditionalLogic; use DefaultValue; @@ -29,38 +29,38 @@ class WysiwygEditorTest extends FieldTestCase use Required; use Wrapper; - public string $field = WysiwygEditor::class; + public string $field = WYSIWYGEditor::class; public string $type = 'wysiwyg'; public function testDisableMediaUpload() { - $field = WysiwygEditor::make('Media Upload')->disableMediaUpload()->get(); + $field = WYSIWYGEditor::make('Media Upload')->disableMediaUpload()->get(); $this->assertFalse($field['media_upload']); } public function testLazyLoad() { - $field = WysiwygEditor::make('Lazy Load')->lazyLoad()->get(); + $field = WYSIWYGEditor::make('Lazy Load')->lazyLoad()->get(); $this->assertTrue($field['delay']); } public function testTabs() { - $field = WysiwygEditor::make('Tabs')->tabs('visual')->get(); + $field = WYSIWYGEditor::make('Tabs')->tabs('visual')->get(); $this->assertSame('visual', $field['tabs']); $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('Invalid argument tabs [test].'); - $field = WysiwygEditor::make('Invalid Tabs')->tabs('test')->get(); + $field = WYSIWYGEditor::make('Invalid Tabs')->tabs('test')->get(); } public function testToolbar() { - $field = WysiwygEditor::make('Toolbar')->toolbar('basic')->get(); + $field = WYSIWYGEditor::make('Toolbar')->toolbar('basic')->get(); $this->assertSame('basic', $field['toolbar']); - $field = WysiwygEditor::make('Toolbar Array')->toolbar(['bold', 'italic'])->get(); + $field = WYSIWYGEditor::make('Toolbar Array')->toolbar(['bold', 'italic'])->get(); $this->assertSame('bold_italic', $field['toolbar']); } }