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/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/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/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/FormTypeTrait.php b/src/Listener/Traits/FormTypeTrait.php index 37013539..4c658a22 100644 --- a/src/Listener/Traits/FormTypeTrait.php +++ b/src/Listener/Traits/FormTypeTrait.php @@ -12,18 +12,10 @@ protected function beforeRenderFormType() { $controller = $this->_controller(); - $formEnableDirtyCheck = $this->_getFormEnableDirtyCheck(); - $formSubmitButtonText = $this->_getFormSubmitButtonText(); - - $controller->set('formEnableDirtyCheck', $formEnableDirtyCheck); - $controller->set('formSubmitButtonText', $formSubmitButtonText); + $controller->set('formEnableDirtyCheck', $this->_getFormEnableDirtyCheck()); + $controller->set('formSubmitButtonText', $this->_getFormSubmitButtonText()); $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()); } /** @@ -35,18 +27,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; } /** @@ -58,18 +39,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'); } /** @@ -81,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'), @@ -113,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; @@ -141,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. * @@ -188,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); } 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); } 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'); } 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'); } /** 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; 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'); -} ?>