Skip to content

Commit 027c21d

Browse files
author
Jim Graham
committed
Minor consistency tweaks
1 parent 114a00e commit 027c21d

File tree

4 files changed

+13
-12
lines changed

4 files changed

+13
-12
lines changed

Diff for: core/lexicon/en/plugin.inc.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
$_lang['plugin_err_duplicate'] = 'An error occurred while trying to duplicate the plugin.';
2525
$_lang['plugin_err_nf'] = 'Plugin not found!';
2626
$_lang['plugin_err_ns'] = 'Plugin not specified.';
27-
$_lang['plugin_err_ns_name'] = 'Please specify a name for the plugin.';
27+
$_lang['plugin_err_ns_name'] = 'Please specify a name for this plugin.';
2828
$_lang['plugin_err_remove'] = 'An error occurred while trying to delete the plugin.';
2929
$_lang['plugin_err_save'] = 'An error occurred while saving the plugin.';
3030
$_lang['plugin_event_err_duplicate'] = 'An error occurred while trying to duplicate the plugin events';

Diff for: core/lexicon/en/snippet.inc.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
$_lang['snippet_err_locked'] = 'This snippet is locked for editing.';
2424
$_lang['snippet_err_nf'] = 'Snippet not found!';
2525
$_lang['snippet_err_ns'] = 'Snippet not specified.';
26-
$_lang['snippet_err_ns_name'] = 'Please specify a name for the snippet.';
26+
$_lang['snippet_err_ns_name'] = 'Please specify a name for this snippet.';
2727
$_lang['snippet_err_remove'] = 'An error occurred while trying to delete the snippet.';
2828
$_lang['snippet_err_save'] = 'An error occurred while saving the snippet.';
2929
$_lang['snippet_execonsave'] = 'Execute snippet after saving.';

Diff for: core/src/Revolution/Processors/Element/Create.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ public function beforeSave()
8686
$this->object->set('description', $description);
8787
}
8888

89-
$name = $this->getProperty($this->elementNameField, '');
90-
9189
/* verify element has a name and that name does not already exist */
9290

91+
$name = $this->getProperty($this->elementNameField, '');
92+
9393
if (empty($name)) {
9494
$this->addFieldError($this->elementNameField, $this->modx->lexicon($this->objectType . '_err_ns_name'));
9595
} else {
9696
if ($this->alreadyExists($name)) {
97-
$this->modx->error->addField(
97+
$this->addFieldError(
9898
$this->elementNameField,
9999
$this->modx->lexicon($this->objectType . '_err_ae', ['name' => $name])
100100
);

Diff for: core/src/Revolution/Processors/Element/Update.php

+8-7
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,14 @@ public function beforeSave()
8686
$name = $this->getProperty($this->elementNameField, '');
8787

8888
if (empty($name)) {
89-
$this->addFieldError($nameField, $this->modx->lexicon($this->objectType . '_err_ns_name'));
90-
} else if ($this->alreadyExists($name)) {
91-
/* if changing name, but new one already exists */
92-
$this->modx->error->addField(
93-
$nameField,
94-
$this->modx->lexicon($this->objectType . '_err_ae', ['name' => $name])
95-
);
89+
$this->addFieldError($this->elementNameField, $this->modx->lexicon($this->objectType . '_err_ns_name'));
90+
} else {
91+
if ($this->alreadyExists($name)) {
92+
$this->addFieldError(
93+
$this->elementNameField,
94+
$this->modx->lexicon($this->objectType . '_err_ae', ['name' => $name])
95+
);
96+
}
9697
}
9798

9899
/* category */

0 commit comments

Comments
 (0)