Skip to content

Commit

Permalink
[imp] spread using prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
phproberto committed Sep 11, 2014
1 parent 3796071 commit c770548
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
<field
name="list"
type="sample"
type="sample.list"
label="COM_SAMPLE_FIELD_LIST"
description="COM_SAMPLE_FIELD_LIST_DESC"
default="1"
Expand All @@ -56,6 +56,8 @@ This is a sample form that uses the library form fields and form rules
</form>
```

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)
4 changes: 2 additions & 2 deletions form/field/sample.php → form/field/list.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion form/rule/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* @subpackage Form
* @since 11.1
*/
class JFormRuleLogin extends JFormRule
class SampleFormRuleLogin extends JFormRule
{
/**
* Method to test the username for uniqueness.
Expand Down

0 comments on commit c770548

Please sign in to comment.