API16

JFormValidator/addRulePath: Difference between revisions

From Joomla! Documentation

m clean up
m preparing for archive only
 
Line 56: Line 56:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=addRulePath
  category=addRulePath
  category=JFormValidator
  category=JFormValidator
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*

Latest revision as of 01:44, 25 March 2017

Description

Method to add a path to the list of rule include paths.


<! removed transcluded page call, red link never existed >

Syntax

addRulePath($new=null)
Parameter Name Default Value Description
$new null $new A path or array of paths to add.

Returns

array The list of paths that have been added.

Defined in

libraries/joomla/form/formvalidator.php

Importing

jimport( 'joomla.form.formvalidator' );

Source Body

public function addRulePath($new = null)
{
        static $paths;

        if (!isset($paths)) {
                $paths = array(dirname(__FILE__).DS.'rules');
        }

        // Force path to an array.
        settype($new, 'array');

        // Add the new paths to the list if not already there.
        foreach ($new as $path) {
                if (!in_array($path, $paths)) {
                        array_unshift($paths, trim($path));
                }
        }

        return $paths;
}


<! removed transcluded page call, red link never existed >

Examples

Code Examples