Skip to content

Commit

Permalink
Minor consistency tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Jim Graham committed Nov 4, 2022
1 parent cdbe1dd commit 754a6c7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion core/lexicon/en/plugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion core/lexicon/en/snippet.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.';
Expand Down
6 changes: 3 additions & 3 deletions core/src/Revolution/Processors/Element/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -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])
);
Expand Down
15 changes: 8 additions & 7 deletions core/src/Revolution/Processors/Element/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 754a6c7

Please sign in to comment.