Joomla CMS  4.2.2
Documentation des API du CMS Joomla en version 4.2.2
Référence de la classe FieldModel
+ Graphe d'héritage de FieldModel:

Fonctions membres publiques

 __construct ($config=array(), MVCFactoryInterface $factory=null)
 
 save ($data)
 
 getItem ($pk=null)
 
 getTable ($name='Field', $prefix='Administrator', $options=array())
 
 delete (&$pks)
 
 getForm ($data=array(), $loadData=true)
 
 setFieldValue ($fieldId, $itemId, $value)
 
 getFieldValue ($fieldId, $itemId)
 
 getFieldValues (array $fieldIds, $itemId)
 
 cleanupValues ($context, $itemId)
 
 validate ($form, $data, $group=null)
 
- Fonctions membres publiques hérités de AdminModel
 __construct ($config=array(), MVCFactoryInterface $factory=null, FormFactoryInterface $formFactory=null)
 
 batch ($commands, $pks, $contexts)
 
 checkin ($pks=array())
 
 checkout ($pk=null)
 
 delete (&$pks)
 
 getItem ($pk=null)
 
 publish (&$pks, $value=1)
 
 reorder ($pks, $delta=0)
 
 save ($data)
 
 saveorder ($pks=array(), $order=null)
 
 generateTitle ($categoryId, $table)
 
 initBatch ()
 
 editAssociations ($data)
 
- Fonctions membres publiques hérités de FormModel
 __construct ($config=array(), MVCFactoryInterface $factory=null, FormFactoryInterface $formFactory=null)
 
 checkin ($pk=null)
 
 checkout ($pk=null)
 
 validate ($form, $data, $group=null)
 
- Fonctions membres publiques hérités de BaseDatabaseModel
 __construct ($config=array(), MVCFactoryInterface $factory=null)
 
 getTable ($name='', $prefix='', $options=array())
 
 isCheckedOut ($item)
 
 getDbo ()
 
 setDbo (DatabaseInterface $db=null)
 
 __get ($name)
 
- Fonctions membres publiques hérités de BaseModel
 __construct ($config=array())
 
 getName ()
 
- Fonctions membres publiques hérités de CMSObject
 __construct ($properties=null)
 
 __toString ()
 
 def ($property, $default=null)
 
 get ($property, $default=null)
 
 getProperties ($public=true)
 
 getError ($i=null, $toString=true)
 
 getErrors ()
 
 set ($property, $value=null)
 
 setProperties ($properties)
 
 setError ($error)
 
- Fonctions membres publiques hérités de StatefulModelInterface
 getState ($property=null, $default=null)
 
 setState ($property, $value=null)
 
- Fonctions membres publiques hérités de DispatcherAwareInterface
 setDispatcher (DispatcherInterface $dispatcher)
 
- Fonctions membres publiques hérités de CurrentUserInterface
 setCurrentUser (User $currentUser)
 
- Fonctions membres publiques hérités de CacheControllerFactoryAwareInterface
 setCacheControllerFactory (CacheControllerFactoryInterface $factory)
 
- Fonctions membres publiques hérités de DatabaseAwareInterface
 setDatabase (DatabaseInterface $db)
 
- Fonctions membres publiques hérités de FormFactoryAwareInterface
 setFormFactory (FormFactoryInterface $factory)
 

Champs de données

 $typeAlias = null
 
- Champs de données hérités de AdminModel
 $typeAlias
 

Fonctions membres protégées

 generateNewTitle ($categoryId, $name, $title)
 
 canDelete ($record)
 
 canEditState ($record)
 
 populateState ()
 
 getReorderConditions ($table)
 
 loadFormData ()
 
 preprocessForm (Form $form, $data, $group='content')
 
 cleanCache ($group=null, $clientId=0)
 
 batchCopy ($value, $pks, $contexts)
 
 batchMove ($value, $pks, $contexts)
 
- Fonctions membres protégées hérités de AdminModel
 batchAccess ($value, $pks, $contexts)
 
 batchCopy ($value, $pks, $contexts)
 
 cleanupPostBatchCopy (TableInterface $table, $newId, $oldId)
 
 batchLanguage ($value, $pks, $contexts)
 
 batchMove ($value, $pks, $contexts)
 
 batchTag ($value, $pks, $contexts)
 
 canDelete ($record)
 
 canEditState ($record)
 
 generateNewTitle ($categoryId, $alias, $title)
 
 getReorderConditions ($table)
 
 populateState ()
 
 prepareTable ($table)
 
 checkCategoryId ($categoryId)
 
 redirectToAssociations ($data)
 
- Fonctions membres protégées hérités de BaseDatabaseModel
 _getList ($query, $limitstart=0, $limit=0)
 
 _getListCount ($query)
 
 _createTable ($name, $prefix='Table', $config=array())
 
 bootComponent ($component)
 
 dispatchEvent (EventInterface $event)
 

Attributs protégés

 $text_prefix = 'COM_FIELDS'
 
 $batch_copymove = 'group_id'
 
 $batch_commands
 
- Attributs protégés hérités de AdminModel
 $text_prefix = null
 
 $event_after_delete = null
 
 $event_after_save = null
 
 $event_before_delete = null
 
 $event_before_save = null
 
 $event_before_change_state = null
 
 $event_change_state = null
 
 $event_before_batch = null
 
 $batch_copymove = 'category_id'
 
 $batch_commands
 
 $associationsContext = null
 
 $batchSet = null
 
 $user = null
 
 $table = null
 
 $tableClassName = null
 
 $contentType = null
 
 $type = null
 
- Attributs protégés hérités de FormModel
 $events_map = null
 
- Attributs protégés hérités de BaseDatabaseModel
 $option = null
 
 $event_clean_cache = null
 
- Attributs protégés hérités de BaseModel
 $name
 
- Attributs protégés hérités de CMSObject
 $_errors = array()
 

Fonctions membres privées

 checkDefaultValue ($data)
 
 getParams ($params)
 

Attributs privés

 $valueCache = array()
 

Membres hérités additionnels

- Fonctions membres publiques statiques hérités de BaseModel
static addIncludePath ($path='', $prefix='')
 
- Attributs protégés statiques hérités de BaseModel
static $paths
 

Description détaillée

Field Model

Depuis
3.7.0

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $config = array(),
MVCFactoryInterface  $factory = null 
)

Constructor

Paramètres
array$configAn array of configuration options (name, state, dbo, table_path, ignore_request).
MVCFactoryInterface$factoryThe factory.
Depuis
3.7.0
Exceptions

Références $config, Symfony\Contracts\Service\__construct(), et Factory\getApplication().

Documentation des fonctions membres

◆ batchCopy()

batchCopy (   $value,
  $pks,
  $contexts 
)
protected

Batch copy fields to a new group.

Paramètres
integer$valueThe new value matching a fields group.
array$pksAn array of row IDs.
array$contextsAn array of item contexts.
Renvoie
array|boolean new IDs if successful, false otherwise and internal error is set.
Depuis
3.7.0

Références $component, $user, $value, Text\_(), et Factory\getUser().

◆ batchMove()

batchMove (   $value,
  $pks,
  $contexts 
)
protected

Batch move fields to a new group.

Paramètres
integer$valueThe new value matching a fields group.
array$pksAn array of row IDs.
array$contextsAn array of item contexts.
Renvoie
boolean True if successful, false otherwise and internal error is set.
Depuis
3.7.0

Références $context, $user, $value, Text\_(), Factory\getApplication(), et Factory\getUser().

◆ canDelete()

canDelete (   $record)
protected

Method to test whether a record can be deleted.

Paramètres
object$recordA record object.
Renvoie
boolean True if allowed to delete the record. Defaults to the permission for the component.
Depuis
3.7.0

Références $parts, FieldsHelper\extract(), et Factory\getUser().

◆ canEditState()

canEditState (   $record)
protected

Method to test whether a record can have its state changed.

Paramètres
object$recordA record object.
Renvoie
boolean True if allowed to change the state of the record. Defaults to the permission for the component.
Depuis
3.7.0

Références $parts, $user, FieldsHelper\extract(), et Factory\getUser().

◆ checkDefaultValue()

checkDefaultValue (   $data)
private

Checks if the default value is valid for the given data. If a string is returned then it can be assumed that the default value is invalid.

Paramètres
array$dataThe data.
Renvoie
true|string true if valid, a string containing the exception message when not.
Depuis
3.7.0

Références $data, $form, $path, $result, $type, Text\_(), FormHelper\addRulePath(), class, Factory\getApplication(), Factory\getContainer(), Joomla\Database\getDatabase(), FieldsHelper\getFieldTypes(), et FormHelper\loadRuleType().

◆ cleanCache()

cleanCache (   $group = null,
  $clientId = 0 
)
protected

Clean the cache

Paramètres
string$groupThe cache group
integer$clientId

Références $context, et Factory\getApplication().

◆ cleanupValues()

cleanupValues (   $context,
  $itemId 
)

Cleaning up the values for the given item on the context.

Paramètres
string$contextThe context.
string$itemIdThe Item ID.
Renvoie
void
Depuis
3.7.0

Références $context, $itemId, $query, et Joomla\Database\getDatabase().

◆ delete()

delete ( $pks)

Method to delete one or more records.

Paramètres
array$pksAn array of record primary keys.
Renvoie
boolean True if successful, false if an error occurs.
Depuis
3.7.0

Références $query, Joomla\Database\getDatabase(), et ArrayHelper\toInteger().

◆ generateNewTitle()

generateNewTitle (   $categoryId,
  $name,
  $title 
)
protected

Method to change the title & name.

Paramètres
integer$categoryIdThe id of the category.
string$nameThe name.
string$titleThe title.
Renvoie
array Contains the modified title and name.
Depuis
3.7.0

Références $name, $title, et StringHelper\increment().

◆ getFieldValue()

getFieldValue (   $fieldId,
  $itemId 
)

Returning the value for the given field id, context and item id.

Paramètres
string$fieldIdThe field ID.
string$itemIdThe ID of the item.
Renvoie
NULL|string
Depuis
3.7.0

Références $itemId, et null.

◆ getFieldValues()

getFieldValues ( array  $fieldIds,
  $itemId 
)

Returning the values for the given field ids, context and item id.

Paramètres
array$fieldIdsThe field Ids.
string$itemIdThe ID of the item.
Renvoie
NULL|array
Depuis
3.7.0

Références $data, $itemId, $key, $query, $rows, Joomla\Database\getDatabase(), et ArrayHelper\toInteger().

◆ getForm()

getForm (   $data = array(),
  $loadData = true 
)

Abstract method for getting the form from the model.

Paramètres
array$dataData for the form.
boolean$loadDataTrue if the form is to load its own data (default case), false if not.
Renvoie
Form|bool A Form object on success, false on failure
Depuis
3.7.0

Implémente FormModelInterface.

Références $context, $data, $form, $parts, FieldsHelper\extract(), Factory\getApplication(), Joomla\CMS\MVC\Model\getState(), Factory\getUser(), PluginHelper\importPlugin(), Joomla\CMS\MVC\Model\loadForm(), et Joomla\CMS\MVC\Model\setState().

◆ getItem()

getItem (   $pk = null)

Method to get a single record.

Paramètres
integer$pkThe id of the primary key.
Renvoie
mixed Object on success, false on failure.
Depuis
3.7.0

Références $db, $query, $result, Factory\getApplication(), Joomla\Database\getDatabase(), Joomla\CMS\MVC\Model\getState(), ParameterType\INTEGER, et null.

◆ getParams()

getParams (   $params)
private

Converts the unknown params into an object.

Paramètres
mixed$paramsThe params.
Renvoie
Object on success, false on failure.
Depuis
3.7.0

Références $params.

◆ getReorderConditions()

getReorderConditions (   $table)
protected

A protected method to get a set of ordering conditions.

Paramètres
Table$tableA Table object.
Renvoie
array An array of conditions to add to ordering queries.
Depuis
3.7.0

Références $db, et Joomla\Database\getDatabase().

◆ getTable()

getTable (   $name = 'Field',
  $prefix = 'Administrator',
  $options = array() 
)

Method to get a table object, load it if necessary.

Paramètres
string$nameThe table name. Optional.
string$prefixThe class prefix. Optional.
array$optionsConfiguration array for model. Optional.
Renvoie
Table A Table object
Depuis
3.7.0
Exceptions

Références $name, $options, et $prefix.

◆ loadFormData()

loadFormData ( )
protected

Method to get the data that should be injected in the form.

Renvoie
array The default data is an empty array.
Depuis
3.7.0

Références $app, $data, $filters, $this, Factory\getApplication(), null, et Joomla\CMS\MVC\Model\preprocessData().

◆ populateState()

populateState ( )
protected

Stock method to auto-populate the model state.

Renvoie
void
Depuis
3.7.0

Références $app, $context, $params, $parts, FieldsHelper\extract(), Factory\getApplication(), ComponentHelper\getParams(), null, et Joomla\CMS\MVC\Model\setState().

◆ preprocessForm()

preprocessForm ( Form  $form,
  $data,
  $group = 'content' 
)
protected

Method to allow derived classes to preprocess the form.

Paramètres
Form$formA Form object.
mixed$dataThe data expected for the form.
string$groupThe name of the plugin group to import (defaults to "content").
Renvoie
void
Depuis
3.7.0
Exceptions

Références $component, $data, $form, $key, $lang, $path, $section, Text\_(), Path\clean(), Factory\getLanguage(), JPATH_ADMINISTRATOR, JPATH_BASE, null, et Joomla\CMS\MVC\Model\preprocessForm().

◆ save()

save (   $data)

Method to save the form data.

Paramètres
array$dataThe form data.
Renvoie
boolean True on success, False on error.
Depuis
3.7.0

If the field is only used in subform, set Category to None automatically so that it will only be displayed as part of SubForm on add/edit item screen

If the options have changed, delete the values. This should only apply for list, checkboxes and radio custom field types, because when their options are being changed, their values might get invalid, because e.g. there is a value selected from a list, which is not part of the list anymore. Hence we need to delete all values that are not part of the options anymore. Note: The only field types with fieldparams+options are those above listed plus the subfields type. And we do explicitly not want the values to be deleted when the options of a subfields field are getting changed.

Références $data, $db, $field, $id, $input, $message, $name, $names, $query, $title, FieldsHelper\clearFieldsCache(), Factory\getApplication(), Joomla\Database\getDatabase(), Joomla\CMS\MVC\Model\getState(), PluginHelper\importPlugin(), ParameterType\INTEGER, null, ParameterType\STRING, et ArrayHelper\toInteger().

◆ setFieldValue()

setFieldValue (   $fieldId,
  $itemId,
  $value 
)

Setting the value for the given field id, context and item id.

Paramètres
string$fieldIdThe field ID.
string$itemIdThe ID of the item.
string$valueThe value.
Renvoie
boolean
Depuis
3.7.0

Références $field, $itemId, $params, $query, $value, FieldsHelper\canEditFieldValue(), FieldsHelper\clearFieldsCache(), elseif, Joomla\Database\getDatabase(), ParameterType\INTEGER, et null.

◆ validate()

validate (   $form,
  $data,
  $group = null 
)

Method to validate the form data.

Paramètres
Form$formThe form to validate against.
array$dataThe data to validate.
string$groupThe name of the field group to validate.
Renvoie
array|boolean Array of filtered data if valid, false otherwise.
Voir également
JFormRule
JFilterInput
Depuis
3.9.23

Références $data, $form, et Factory\getUser().

Documentation des champs

◆ $batch_commands

$batch_commands
protected
Valeur initiale :
= array(
'assetgroup_id' => 'batchAccess',
'language_id' => 'batchLanguage'
)

◆ $batch_copymove

$batch_copymove = 'group_id'
protected

◆ $text_prefix

$text_prefix = 'COM_FIELDS'
protected

◆ $typeAlias

$typeAlias = null

◆ $valueCache

$valueCache = array()
private

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