diff --git a/core/lexicon/en/plugin.inc.php b/core/lexicon/en/plugin.inc.php index a153e8841c9..25d0411a2e7 100644 --- a/core/lexicon/en/plugin.inc.php +++ b/core/lexicon/en/plugin.inc.php @@ -24,7 +24,7 @@ $_lang['plugin_err_duplicate'] = 'An error occurred while trying to duplicate the plugin.'; $_lang['plugin_err_nf'] = 'Plugin not found!'; $_lang['plugin_err_ns'] = 'Plugin not specified.'; -$_lang['plugin_err_ns_name'] = 'Please specify a name for the plugin.'; +$_lang['plugin_err_ns_name'] = 'Please specify a name for this plugin.'; $_lang['plugin_err_remove'] = 'An error occurred while trying to delete the plugin.'; $_lang['plugin_err_save'] = 'An error occurred while saving the plugin.'; $_lang['plugin_event_err_duplicate'] = 'An error occurred while trying to duplicate the plugin events'; diff --git a/core/lexicon/en/snippet.inc.php b/core/lexicon/en/snippet.inc.php index b6f45c5b654..11888d79bc7 100644 --- a/core/lexicon/en/snippet.inc.php +++ b/core/lexicon/en/snippet.inc.php @@ -23,7 +23,7 @@ $_lang['snippet_err_locked'] = 'This snippet is locked for editing.'; $_lang['snippet_err_nf'] = 'Snippet not found!'; $_lang['snippet_err_ns'] = 'Snippet not specified.'; -$_lang['snippet_err_ns_name'] = 'Please specify a name for the snippet.'; +$_lang['snippet_err_ns_name'] = 'Please specify a name for this snippet.'; $_lang['snippet_err_remove'] = 'An error occurred while trying to delete the snippet.'; $_lang['snippet_err_save'] = 'An error occurred while saving the snippet.'; $_lang['snippet_execonsave'] = 'Execute snippet after saving.'; diff --git a/core/src/Revolution/Processors/Element/Create.php b/core/src/Revolution/Processors/Element/Create.php index 457f01607e3..678fd502817 100644 --- a/core/src/Revolution/Processors/Element/Create.php +++ b/core/src/Revolution/Processors/Element/Create.php @@ -86,15 +86,15 @@ public function beforeSave() $this->object->set('description', $description); } - $name = $this->getProperty($this->elementNameField, ''); - /* verify element has a name and that name does not already exist */ + $name = $this->getProperty($this->elementNameField, ''); + if (empty($name)) { $this->addFieldError($this->elementNameField, $this->modx->lexicon($this->objectType . '_err_ns_name')); } else { if ($this->alreadyExists($name)) { - $this->modx->error->addField( + $this->addFieldError( $this->elementNameField, $this->modx->lexicon($this->objectType . '_err_ae', ['name' => $name]) ); diff --git a/core/src/Revolution/Processors/Element/Update.php b/core/src/Revolution/Processors/Element/Update.php index f570e487721..888c14b75fc 100644 --- a/core/src/Revolution/Processors/Element/Update.php +++ b/core/src/Revolution/Processors/Element/Update.php @@ -86,13 +86,14 @@ public function beforeSave() $name = $this->getProperty($this->elementNameField, ''); if (empty($name)) { - $this->addFieldError($nameField, $this->modx->lexicon($this->objectType . '_err_ns_name')); - } else if ($this->alreadyExists($name)) { - /* if changing name, but new one already exists */ - $this->modx->error->addField( - $nameField, - $this->modx->lexicon($this->objectType . '_err_ae', ['name' => $name]) - ); + $this->addFieldError($this->elementNameField, $this->modx->lexicon($this->objectType . '_err_ns_name')); + } else { + if ($this->alreadyExists($name)) { + $this->addFieldError( + $this->elementNameField, + $this->modx->lexicon($this->objectType . '_err_ae', ['name' => $name]) + ); + } } /* category */