Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe JFormHelper

Liste de tous les membres

Fonctions membres publiques statiques

static loadFieldType ($type, $new=true)
static loadRuleType ($type, $new=true)
static loadFieldClass ($type)
static loadRuleClass ($type)
static addFieldPath ($new=null)
static addFormPath ($new=null)
static addRulePath ($new=null)

Fonctions membres protégées statiques

static loadType ($entity, $type, $new=true)
static loadClass ($entity, $type)
static addPath ($entity, $new=null)

Attributs protégés statiques

static $paths
static $entities = array()

Description détaillée

Définition à la ligne 23 du fichier helper.php.


Documentation des fonctions membres

static JFormHelper::addFieldPath (   $new = null)
static

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

Paramètres:
mixed$newA path or array of paths to add.
Renvoie:
array The list of paths that have been added.
Depuis:
11.1

Définition à la ligne 237 du fichier helper.php.

Référencé par JForm\addFieldPath().

{
return self::addPath('field', $new);
}

+ Voici le graphe des appelants de cette fonction :

static JFormHelper::addFormPath (   $new = null)
static

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

Paramètres:
mixed$newA path or array of paths to add.
Renvoie:
array The list of paths that have been added.
Depuis:
11.1

Définition à la ligne 251 du fichier helper.php.

Référencé par JForm\addFormPath().

{
return self::addPath('form', $new);
}

+ Voici le graphe des appelants de cette fonction :

static JFormHelper::addPath (   $entity,
  $new = null 
)
staticprotected

Method to add a path to the list of include paths for one of the form's entities. Currently supported entities: field, rule and form. You are free to support your own in a subclass.

Paramètres:
string$entityForm's entity name for which paths will be added.
mixed$newA path or array of paths to add.
Renvoie:
array The list of paths that have been added.
Depuis:
11.1

Définition à la ligne 281 du fichier helper.php.

{
// Reference to an array with paths for current entity
$paths = &self::$paths[$entity];
// Add the default entity's search path if not set.
if (empty($paths))
{
// While we support limited number of entities (form, field and rule)
// we can do this simple pluralisation:
$entity_plural = $entity . 's';
/*
* But when someday we would want to support more entities, then we should consider adding
* an inflector class to "libraries/joomla/utilities" and use it here (or somebody can use a real inflector in his subclass).
* See also: pluralization snippet by Paul Osman in JControllerForm's constructor.
*/
$paths[] = __DIR__ . '/' . $entity_plural;
}
// Force the new path(s) to an array.
settype($new, 'array');
// Add the new paths to the stack if not already there.
foreach ($new as $path)
{
if (!in_array($path, $paths))
{
array_unshift($paths, trim($path));
}
}
return $paths;
}
static JFormHelper::addRulePath (   $new = null)
static

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

Paramètres:
mixed$newA path or array of paths to add.
Renvoie:
array The list of paths that have been added.
Depuis:
11.1

Définition à la ligne 265 du fichier helper.php.

Référencé par JForm\addRulePath().

{
return self::addPath('rule', $new);
}

+ Voici le graphe des appelants de cette fonction :

static JFormHelper::loadClass (   $entity,
  $type 
)
staticprotected

Load a class for one of the form's entities of a particular type. Currently, it makes sense to use this method for the "field" and "rule" entities (but you can support more entities in your subclass).

Paramètres:
string$entityOne of the form entities (field or rule).
string$typeType of an entity.
Renvoie:
mixed Class name on success or false otherwise.
Depuis:
11.1

Définition à la ligne 169 du fichier helper.php.

Références JPath\find(), et JString\ucfirst().

{
if (strpos($type, '.'))
{
list($prefix, $type) = explode('.', $type);
}
else
{
$prefix = 'J';
}
$class = JString::ucfirst($prefix, '_') . 'Form' . JString::ucfirst($entity, '_') . JString::ucfirst($type, '_');
if (class_exists($class))
{
return $class;
}
// Get the field search path array.
$paths = self::addPath($entity);
// If the type is complex, add the base type to the paths.
if ($pos = strpos($type, '_'))
{
// Add the complex type prefix to the paths.
for ($i = 0, $n = count($paths); $i < $n; $i++)
{
// Derive the new path.
$path = $paths[$i] . '/' . strtolower(substr($type, 0, $pos));
// If the path does not exist, add it.
if (!in_array($path, $paths))
{
$paths[] = $path;
}
}
// Break off the end of the complex type.
$type = substr($type, $pos + 1);
}
// Try to find the class file.
$type = strtolower($type) . '.php';
foreach ($paths as $path)
{
if ($file = JPath::find($path, $type))
{
require_once $file;
if (class_exists($class))
{
break;
}
}
}
// Check for all if the class exists.
return class_exists($class) ? $class : false;
}

+ Voici le graphe d'appel pour cette fonction :

static JFormHelper::loadFieldClass (   $type)
static

Attempt to import the JFormField class file if it isn't already imported. You can use this method outside of JForm for loading a field for inheritance or composition.

Paramètres:
string$typeType of a field whose class should be loaded.
Renvoie:
mixed Class name on success or false otherwise.
Depuis:
11.1

Définition à la ligne 137 du fichier helper.php.

{
return self::loadClass('field', $type);
}
static JFormHelper::loadFieldType (   $type,
  $new = true 
)
static

Method to load a form field object given a type.

Paramètres:
string$typeThe field type.
boolean$newFlag to toggle whether we should get a new instance of the object.
Renvoie:
mixed JFormField object on success, false otherwise.
Depuis:
11.1

Définition à la ligne 68 du fichier helper.php.

Référencé par JForm\loadFieldType().

{
return self::loadType('field', $type, $new);
}

+ Voici le graphe des appelants de cette fonction :

static JFormHelper::loadRuleClass (   $type)
static

Attempt to import the JFormRule class file if it isn't already imported. You can use this method outside of JForm for loading a rule for inheritance or composition.

Paramètres:
string$typeType of a rule whose class should be loaded.
Renvoie:
mixed Class name on success or false otherwise.
Depuis:
11.1

Définition à la ligne 152 du fichier helper.php.

{
return self::loadClass('rule', $type);
}
static JFormHelper::loadRuleType (   $type,
  $new = true 
)
static

Method to load a form rule object given a type.

Paramètres:
string$typeThe rule type.
boolean$newFlag to toggle whether we should get a new instance of the object.
Renvoie:
mixed JFormRule object on success, false otherwise.
Depuis:
11.1

Définition à la ligne 83 du fichier helper.php.

Référencé par JForm\loadRuleType().

{
return self::loadType('rule', $type, $new);
}

+ Voici le graphe des appelants de cette fonction :

static JFormHelper::loadType (   $entity,
  $type,
  $new = true 
)
staticprotected

Method to load a form entity object given a type. Each type is loaded only once and then used as a prototype for other objects of same type. Please, use this method only with those entities which support types (forms don't support them).

Paramètres:
string$entityThe entity.
string$typeThe entity type.
boolean$newFlag to toggle whether we should get a new instance of the object.
Renvoie:
mixed Entity object on success, false otherwise.
Depuis:
11.1

Définition à la ligne 101 du fichier helper.php.

{
// Reference to an array with current entity's type instances
$types = &self::$entities[$entity];
$key = md5($type);
// Return an entity object if it already exists and we don't need a new one.
if (isset($types[$key]) && $new === false)
{
return $types[$key];
}
$class = self::loadClass($entity, $type);
if ($class !== false)
{
// Instantiate a new type object.
$types[$key] = new $class;
return $types[$key];
}
else
{
return false;
}
}

Documentation des données membres

JFormHelper::$entities = array()
staticprotected

Définition à la ligne 56 du fichier helper.php.

JFormHelper::$paths
staticprotected

Définition à la ligne 40 du fichier helper.php.


La documentation de cette classe a été générée à partir du fichier suivant :