From 9c780ff0f13a24a1727cde30a3d47f57d6afe62e Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 27 Jun 2017 19:51:19 -0600 Subject: [PATCH 01/10] fix: remove deprecated method of setting site title --- config/defaults.php | 1 - .../site-title-options.rst | 4 +--- src/Listener/Traits/SiteTitleTrait.php | 19 ++----------------- 3 files changed, 3 insertions(+), 21 deletions(-) diff --git a/config/defaults.php b/config/defaults.php index cb79f145..ed15b820 100644 --- a/config/defaults.php +++ b/config/defaults.php @@ -3,7 +3,6 @@ return [ 'CrudView' => [ - 'brand' => 'Crud View', 'siteTitle' => 'Crud View', 'css' => [ 'https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.4/css/bootstrap.css', diff --git a/docs/general-configuration/site-title-options.rst b/docs/general-configuration/site-title-options.rst index ad5a99fd..56ad5dcc 100644 --- a/docs/general-configuration/site-title-options.rst +++ b/docs/general-configuration/site-title-options.rst @@ -8,11 +8,9 @@ Site Title ---------- You can use the ``scaffold.site_title`` config variable to modify the title. If -not set, it will fallback to the following alternatives: +not set, it will fallback to the following alternative: - ``Configure::read('CrudView.siteTitle')`` -- ``$action->config('scaffold.brand')``: Deprecated -- ``Configure::read('CrudView.brand')``: Deprecated .. code-block:: php diff --git a/src/Listener/Traits/SiteTitleTrait.php b/src/Listener/Traits/SiteTitleTrait.php index 637a388d..b1c71187 100644 --- a/src/Listener/Traits/SiteTitleTrait.php +++ b/src/Listener/Traits/SiteTitleTrait.php @@ -14,13 +14,9 @@ public function beforeRenderSiteTitle() { $controller = $this->_controller(); - $siteTitle = $this->_getSiteTitle(); - $controller->set('siteTitle', $siteTitle); + $controller->set('siteTitle', $this->_getSiteTitle()); $controller->set('siteTitleLink', $this->_getSiteTitleLink()); $controller->set('siteTitleImage', $this->_getSiteTitleImage()); - - // deprecated - $controller->set('brand', $siteTitle); } /** @@ -37,18 +33,7 @@ protected function _getSiteTitle() return $title; } - $title = Configure::read('CrudView.siteTitle'); - if (!empty($title)) { - return $title; - } - - // deprecated - $title = $action->getConfig('scaffold.brand'); - if (!empty($title)) { - return $title; - } - - return Configure::read('CrudView.brand'); + return Configure::read('CrudView.siteTitle'); } /** From 807d5b45284f1affa7161f46aeafe82ab275ed23 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 27 Jun 2017 19:52:37 -0600 Subject: [PATCH 02/10] fix: remove deprecated blog-related variables --- docs/index-pages/components/blog.rst | 4 --- src/Listener/Traits/IndexTypeTrait.php | 37 ++------------------------ 2 files changed, 2 insertions(+), 39 deletions(-) diff --git a/docs/index-pages/components/blog.rst b/docs/index-pages/components/blog.rst index 5c0c9819..24613219 100644 --- a/docs/index-pages/components/blog.rst +++ b/docs/index-pages/components/blog.rst @@ -22,10 +22,6 @@ The blog index type has two main options: $action->config('scaffold.index_title_field', 'name'); $action->config('scaffold.index_body_field', 'content'); - // the following are deprecated ways of setting the title and body - $action->config('scaffold.index_blog_title_field', 'name'); - $action->config('scaffold.index_blog_body_field', 'content'); - Available Variables ------------------- diff --git a/src/Listener/Traits/IndexTypeTrait.php b/src/Listener/Traits/IndexTypeTrait.php index bcbddf3b..b79523b1 100644 --- a/src/Listener/Traits/IndexTypeTrait.php +++ b/src/Listener/Traits/IndexTypeTrait.php @@ -10,20 +10,14 @@ trait IndexTypeTrait */ public function beforeRenderIndexType() { - $indexTitleField = $this->_getIndexTitleField(); - $indexBodyField = $this->_getIndexBodyField(); - $controller = $this->_controller(); $controller->set('indexFinderScopes', $this->_getIndexFinderScopes()); $controller->set('indexFormats', $this->_getIndexFormats()); $controller->set('indexType', $this->_getIndexType()); - $controller->set('indexTitleField', $indexTitleField); - $controller->set('indexBodyField', $indexBodyField); + $controller->set('indexTitleField', $this->_getIndexTitleField()); + $controller->set('indexBodyField', $this->_getIndexBodyField()); $controller->set('indexImageField', $this->_getIndexImageField()); $controller->seT('indexGalleryCssClasses', $this->_getIndexGalleryCssClasses()); - - $controller->set('indexBlogTitleField', $indexTitleField); - $controller->set('indexBlogBodyField', $indexBodyField); } /** @@ -80,16 +74,6 @@ protected function _getIndexTitleField() $field = $action->getConfig('scaffold.index_title_field'); if ($field === null) { - $field = $action->getConfig('scaffold.index_blog_title_field'); - if ($field !== null) { - $this->deprecatedScaffoldKeyNotice( - 'scaffold.index_blog_title_field', - 'scaffold.index_title_field' - ); - } - } - - if (empty($field)) { $field = $this->_table()->getDisplayField(); } @@ -107,16 +91,6 @@ protected function _getIndexBodyField() $field = $action->getConfig('scaffold.index_body_field'); if ($field === null) { - $field = $action->getConfig('scaffold.index_blog_body_field'); - if ($field !== null) { - $this->deprecatedScaffoldKeyNotice( - 'scaffold.index_blog_body_field', - 'scaffold.index_body_field' - ); - } - } - - if (empty($field)) { $field = 'body'; } @@ -171,11 +145,4 @@ abstract protected function _action($name = null); * {@inheritDoc} */ abstract protected function _table(); - - /** - * {@inheritDoc} - * @param string $deprecatedKey - * @param string $newKey - */ - abstract protected function deprecatedScaffoldKeyNotice($deprecatedKey, $newKey); } From 6dca302eff4295883d4c013c9df3cf91cb7f07e7 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 27 Jun 2017 19:53:02 -0600 Subject: [PATCH 03/10] fix: remove deprecated method of enabling dirty form checks --- src/Listener/Traits/FormTypeTrait.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/Listener/Traits/FormTypeTrait.php b/src/Listener/Traits/FormTypeTrait.php index 37013539..244ad347 100644 --- a/src/Listener/Traits/FormTypeTrait.php +++ b/src/Listener/Traits/FormTypeTrait.php @@ -35,18 +35,7 @@ protected function _getFormEnableDirtyCheck() { $action = $this->_action(); - $formEnableDirtyCheck = $action->getConfig('scaffold.form_enable_dirty_check'); - if ($formEnableDirtyCheck === null) { - $formEnableDirtyCheck = $action->getConfig('scaffold.enable_dirty_check'); - if ($formEnableDirtyCheck !== null) { - $this->deprecatedScaffoldKeyNotice( - 'scaffold.enable_dirty_check', - 'scaffold.form_enable_dirty_check' - ); - } - } - - return $formEnableDirtyCheck ?: false; + return $action->getConfig('scaffold.form_enable_dirty_check') ?: false; } /** From 0909c7b8e8c229b6d95ff035a2b585ba5d5bd70a Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 27 Jun 2017 19:53:49 -0600 Subject: [PATCH 04/10] fix: remove deprecated method of setting the form submit button text --- src/Listener/Traits/FormTypeTrait.php | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/Listener/Traits/FormTypeTrait.php b/src/Listener/Traits/FormTypeTrait.php index 244ad347..73ef9e58 100644 --- a/src/Listener/Traits/FormTypeTrait.php +++ b/src/Listener/Traits/FormTypeTrait.php @@ -47,18 +47,7 @@ protected function _getFormSubmitButtonText() { $action = $this->_action(); - $formSubmitButtonText = $action->getConfig('scaffold.form_submit_button_text'); - if ($formSubmitButtonText === null) { - $formSubmitButtonText = $action->getConfig('scaffold.submit_button_text'); - if ($formSubmitButtonText !== null) { - $this->deprecatedScaffoldKeyNotice( - 'scaffold.submit_button_text', - 'scaffold.form_submit_button_text' - ); - } - } - - return $formSubmitButtonText ?: __d('crud', 'Save'); + return $action->getConfig('scaffold.form_submit_button_text') ?: __d('crud', 'Save'); } /** From 79c88d507d7ace5c64d40ee8cb26c34248aa4efe Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 27 Jun 2017 19:54:28 -0600 Subject: [PATCH 05/10] fix: remove deprecated viewblocks --- src/Template/Element/form.ctp | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/Template/Element/form.ctp b/src/Template/Element/form.ctp index e823aea2..391c099d 100644 --- a/src/Template/Element/form.ctp +++ b/src/Template/Element/form.ctp @@ -3,13 +3,6 @@ $formSidebarExists = $this->exists('form.sidebar'); if ($this->exists('form.before_create')) { echo $this->fetch('form.before_create'); } -if ($this->exists('before_form')) { - $template = 'The view block %s has been deprecated. Use %s instead.'; - $message = sprintf($template, 'before_form', 'form.before_create'); - trigger_error($message, E_USER_DEPRECATED); - - echo $this->fetch('before_form'); -} ?>
@@ -48,11 +41,4 @@ if ($this->exists('before_form')) { if ($this->exists('form.after_end')) { echo $this->fetch('form.after_end'); } -if ($this->exists('after_form')) { - $template = 'The view block %s has been deprecated. Use %s instead.'; - $message = sprintf($template, 'after_form', 'form.after_end'); - trigger_error($message, E_USER_DEPRECATED); - - echo $this->fetch('after_form'); -} ?> From 6b92ec48297c1356d17901c81b575f74660995db Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 27 Jun 2017 19:55:13 -0600 Subject: [PATCH 06/10] fix: remove dirty check --- src/Listener/Traits/FormTypeTrait.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Listener/Traits/FormTypeTrait.php b/src/Listener/Traits/FormTypeTrait.php index 73ef9e58..05fbb493 100644 --- a/src/Listener/Traits/FormTypeTrait.php +++ b/src/Listener/Traits/FormTypeTrait.php @@ -12,15 +12,13 @@ protected function beforeRenderFormType() { $controller = $this->_controller(); - $formEnableDirtyCheck = $this->_getFormEnableDirtyCheck(); $formSubmitButtonText = $this->_getFormSubmitButtonText(); - $controller->set('formEnableDirtyCheck', $formEnableDirtyCheck); + $controller->set('formEnableDirtyCheck', $this->_getFormEnableDirtyCheck()); $controller->set('formSubmitButtonText', $formSubmitButtonText); $controller->set('formSubmitExtraButtons', $this->_getFormSubmitExtraButtons()); $controller->set('formUrl', $this->_getFormUrl()); - $controller->set('enableDirtyCheck', $formEnableDirtyCheck); $controller->set('submitButtonText', $formSubmitButtonText); $controller->set('disableExtraButtons', $this->_getFormDisableExtraButtons()); $controller->set('extraButtonsBlacklist', $this->_getFormExtraButtonsBlacklist()); From 829a4688da8407a52d22cd7a39b092a25d1ce490 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 27 Jun 2017 19:55:36 -0600 Subject: [PATCH 07/10] fix: remove submit button text --- src/Listener/Traits/FormTypeTrait.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Listener/Traits/FormTypeTrait.php b/src/Listener/Traits/FormTypeTrait.php index 05fbb493..3c918c0c 100644 --- a/src/Listener/Traits/FormTypeTrait.php +++ b/src/Listener/Traits/FormTypeTrait.php @@ -12,14 +12,10 @@ protected function beforeRenderFormType() { $controller = $this->_controller(); - $formSubmitButtonText = $this->_getFormSubmitButtonText(); - $controller->set('formEnableDirtyCheck', $this->_getFormEnableDirtyCheck()); - $controller->set('formSubmitButtonText', $formSubmitButtonText); + $controller->set('formSubmitButtonText', $this->_getFormSubmitButtonText()); $controller->set('formSubmitExtraButtons', $this->_getFormSubmitExtraButtons()); $controller->set('formUrl', $this->_getFormUrl()); - - $controller->set('submitButtonText', $formSubmitButtonText); $controller->set('disableExtraButtons', $this->_getFormDisableExtraButtons()); $controller->set('extraButtonsBlacklist', $this->_getFormExtraButtonsBlacklist()); } From ed043576de9f1c2a86a63415db36236e63ee5398 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 27 Jun 2017 19:56:36 -0600 Subject: [PATCH 08/10] fix: remove alternative methods of specifying extra submit buttons --- docs/basic-usage.rst | 24 ++--------- src/Listener/Traits/FormTypeTrait.php | 61 --------------------------- 2 files changed, 3 insertions(+), 82 deletions(-) diff --git a/docs/basic-usage.rst b/docs/basic-usage.rst index e3cb8b1f..d860cc87 100644 --- a/docs/basic-usage.rst +++ b/docs/basic-usage.rst @@ -356,36 +356,18 @@ Disabling the Extra Submit Buttons ---------------------------------- You may have noticed already that in the ``add`` form there are multiple submit -buttons. If you wish to only keep the "Save" button, you set the ``scaffold.disable_extra_buttons`` -configuration key to ``true``: +buttons. If you wish to only keep the "Save" button, you set the +``scaffold.form_submit_extra_buttons`` configuration key to ``false``: .. code-block:: php public function add() { $action = $this->Crud->action(); - $action->config('scaffold.disable_extra_buttons', true); + $action->config('scaffold.form_submit_extra_buttons', false); return $this->Crud->execute(); } -It is also possible to only disable a few of the extra submit buttons by using -the ``scaffold.extra_buttons_blacklist`` configuration key: - -.. code-block:: php - - public function add() - { - $action = $this->Crud->action(); - $action->config('scaffold.extra_buttons_blacklist', [ - 'save_and_continue', // Hide the Save and Continue button - 'save_and_create', // Hide the Save and create new button - 'back', // Hide the back button - ]); - return $this->Crud->execute(); - } - -Both settings can be used in ``add`` and ``edit`` actions. - Implementing a View Action -------------------------- diff --git a/src/Listener/Traits/FormTypeTrait.php b/src/Listener/Traits/FormTypeTrait.php index 3c918c0c..4c658a22 100644 --- a/src/Listener/Traits/FormTypeTrait.php +++ b/src/Listener/Traits/FormTypeTrait.php @@ -16,8 +16,6 @@ protected function beforeRenderFormType() $controller->set('formSubmitButtonText', $this->_getFormSubmitButtonText()); $controller->set('formSubmitExtraButtons', $this->_getFormSubmitExtraButtons()); $controller->set('formUrl', $this->_getFormUrl()); - $controller->set('disableExtraButtons', $this->_getFormDisableExtraButtons()); - $controller->set('extraButtonsBlacklist', $this->_getFormExtraButtonsBlacklist()); } /** @@ -53,16 +51,6 @@ protected function _getFormSubmitExtraButtons() { $action = $this->_action(); - $disableExtraButtons = $this->_getFormDisableExtraButtons(); - if ($disableExtraButtons === true) { - $this->deprecatedScaffoldKeyNotice( - 'scaffold.disable_extra_buttons', - 'scaffold.form_submit_extra_buttons' - ); - - return []; - } - $defaults = [ [ 'title' => __d('crud', 'Save & continue editing'), @@ -85,22 +73,6 @@ protected function _getFormSubmitExtraButtons() ], ]; - $extraButtonsBlacklist = $this->_getFormExtraButtonsBlacklist(); - if (!empty($extraButtonsBlacklist)) { - $this->deprecatedScaffoldKeyNotice( - 'scaffold.extra_buttons_blacklist', - 'scaffold.form_submit_extra_buttons' - ); - $newDefaults = []; - foreach ($defaults as $default) { - if (in_array($default['_label'], $extraButtonsBlacklist)) { - continue; - } - $newDefaults[] = $default; - } - $defaults = $newDefaults; - } - $buttons = $action->getConfig('scaffold.form_submit_extra_buttons'); if ($buttons === null || $buttons === true) { $buttons = $defaults; @@ -113,32 +85,6 @@ protected function _getFormSubmitExtraButtons() return $buttons; } - /** - * Disable extra buttons. - * - * @return bool - * @deprecated 0.7.0 Deprecated in favor of form_submit_extra_buttons - */ - protected function _getFormDisableExtraButtons() - { - $action = $this->_action(); - - return $action->getConfig('scaffold.disable_extra_buttons') ?: false; - } - - /** - * Get extra buttons blacklist - * - * @return array - * @deprecated 0.7.0 Deprecated in favor of form_submit_extra_buttons - */ - protected function _getFormExtraButtonsBlacklist() - { - $action = $this->_action(); - - return $action->getConfig('scaffold.extra_buttons_blacklist') ?: []; - } - /** * Get form url. * @@ -160,11 +106,4 @@ abstract protected function _controller(); * {@inheritDoc} */ abstract protected function _action($name = null); - - /** - * {@inheritDoc} - * @param string $deprecatedKey - * @param string $newKey - */ - abstract protected function deprecatedScaffoldKeyNotice($deprecatedKey, $newKey); } From 9a68a81f77d6d22580a1ada4ae727f784ebdf1bb Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 27 Jun 2017 19:56:50 -0600 Subject: [PATCH 09/10] fix: remove deprecated method of disabling the navigation sidebar --- src/Listener/Traits/SidebarNavigationTrait.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/Listener/Traits/SidebarNavigationTrait.php b/src/Listener/Traits/SidebarNavigationTrait.php index 37d7d554..16184ee4 100644 --- a/src/Listener/Traits/SidebarNavigationTrait.php +++ b/src/Listener/Traits/SidebarNavigationTrait.php @@ -25,11 +25,6 @@ protected function _getSidebarNavigation() { $action = $this->_action(); - // deprecated check - if ($action->getConfig('scaffold.disable_sidebar')) { - return false; - } - return $action->getConfig('scaffold.sidebar_navigation'); } From b54aea685a9138a878d3f54234e4b27bbaf20d2c Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Tue, 27 Jun 2017 19:57:16 -0600 Subject: [PATCH 10/10] chore: drop unused trait --- src/Listener/ViewListener.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Listener/ViewListener.php b/src/Listener/ViewListener.php index e5709a80..186cc7e5 100644 --- a/src/Listener/ViewListener.php +++ b/src/Listener/ViewListener.php @@ -6,7 +6,6 @@ use Cake\Event\Event; use Cake\Utility\Hash; use Cake\Utility\Inflector; -use CrudView\Listener\Traits\DeprecatedConfigurationKeyTrait; use CrudView\Listener\Traits\FormTypeTrait; use CrudView\Listener\Traits\IndexTypeTrait; use CrudView\Listener\Traits\SidebarNavigationTrait; @@ -18,7 +17,6 @@ class ViewListener extends BaseListener { use CrudViewConfigTrait; - use DeprecatedConfigurationKeyTrait; use FormTypeTrait; use IndexTypeTrait; use SidebarNavigationTrait;