From c770548ebe3078b2c3016a7813766f702061fec8 Mon Sep 17 00:00:00 2001 From: Roberto - phproberto Date: Fri, 12 Sep 2014 01:31:07 +0200 Subject: [PATCH] [imp] spread using prefixes --- README.md | 10 ++++++---- form/field/{sample.php => list.php} | 4 ++-- form/rule/login.php | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) rename form/field/{sample.php => list.php} (96%) diff --git a/README.md b/README.md index 32c74a2..8319ac4 100644 --- a/README.md +++ b/README.md @@ -42,11 +42,11 @@ This is a sample form that uses the library form fields and form rules type="text" label="COM_SAMPLE_FIELD_NAME" description="COM_SAMPLE_FIELD_NAME_DESC" - validate="login" + validate="sample.login" /> ``` -The first field uses the `login` form rule (which is just a copy&rename of the standard `username` joomla rule) to validate a username/login. +The first field uses the `sample.login` form rule (which is just a copy&rename of the standard `username` joomla rule) to validate a username/login. -The second field uses a custom field defined inside the library (`sample`). +The second field uses a custom field defined inside the library (`sample.list`). + +Note that we call our fields/rules with `prefix.field` and `prefix.rule`. That means that we use a custom prefix for them instead of the core fields `J` prefix. [Read why](http://phproberto.com/en/blog/26-joomla-form-fields-rules-right-way) diff --git a/form/field/sample.php b/form/field/list.php similarity index 96% rename from form/field/sample.php rename to form/field/list.php index f4712c7..0c84c4a 100644 --- a/form/field/sample.php +++ b/form/field/list.php @@ -12,13 +12,13 @@ JFormHelper::loadFieldClass('list'); /** - * Sample form field + * Sample list form field * * @package Sample.Library * @subpackage Field * @since 1.0 */ -class JFormFieldSample extends JFormFieldList +class SampleFormFieldList extends JFormFieldList { /** * The form field type. diff --git a/form/rule/login.php b/form/rule/login.php index 9b2a1eb..fa4c368 100644 --- a/form/rule/login.php +++ b/form/rule/login.php @@ -16,7 +16,7 @@ * @subpackage Form * @since 11.1 */ -class JFormRuleLogin extends JFormRule +class SampleFormRuleLogin extends JFormRule { /** * Method to test the username for uniqueness.