Source for file tags.php
Documentation is available at tags.php
* @package Joomla.Libraries
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* Abstract class defining methods that can be
* implemented by an Observer class of a JTable class (which is an Observable).
* Attaches $this Observer to the $table in the constructor.
* The classes extending this class should not be instanciated directly, as they
* are automatically instanciated by the JObserverMapper
* @package Joomla.Libraries
* @link http://docs.joomla.org/JTableObserver
* Helper object for managing tags
* The pattern for this table's TypeAlias
* Override for postStoreProcess param newTags, Set by setNewTags, used by onAfterStore and onBeforeStore
* Override for postStoreProcess param replaceTags. Set by setNewTags, used by onAfterStore
* Not public, so marking private and deprecated, but needed internally in parseTypeAlias for
* PHP < 5.4.0 as it's not passing context $this to closure function.
* @var JTableObserverTags
* @deprecated Never use this
public static $_myTableForPregreplaceOnly;
* Creates the associated observer instance and attaches it to the $observableObject
* Creates the associated tags helper class instance
* $typeAlias can be of the form "{variableName}.type", automatically replacing {variableName} with table-instance variables variableName
* @param JObservableInterface $observableObject The subject object to be observed
* @param array $params ( 'typeAlias' => $typeAlias )
* @return JTableObserverTags
public static function createObserver(JObservableInterface $observableObject, $params =
array())
$typeAlias =
$params['typeAlias'];
$observer =
new self($observableObject);
$observer->typeAliasPattern =
$typeAlias;
* Pre-processor for $table->store($updateNulls)
* @param boolean $updateNulls The result of the load
* @param string $tableKey The key of the table
if (empty($this->table->tagsHelper->tags))
* Post-processor for $table->store($updateNulls)
* You can change optional params newTags and replaceTags of tagsHelper with method setNewTagsToAdd
* @param boolean &$result The result of the load
if (empty($this->table->tagsHelper->tags))
// Restore default values for the optional params:
* Pre-processor for $table->delete($pk)
* @param mixed $pk An optional primary key value to delete. If not set the instance property value is used.
* @throws UnexpectedValueException
* Sets the new tags to be added or to replace existing tags
* @param array $newTags New tags to be added to or replace current tags for an item
* @param boolean $replaceTags Replace tags (true) or add them (false)
public function setNewTags($newTags, $replaceTags)
* Parses a TypeAlias of the form "{variableName}.type", replacing {variableName} with table-instance variables variableName
* Storing result into $this->tagsHelper->typeAlias
// Needed for PHP < 5.4.0 as it's not passing context $this to closure function
static::$_myTableForPregreplaceOnly =
$this->table;
$this->tagsHelper->typeAlias =
preg_replace_callback('/{([^}]+)}/',
return JTableObserverTags::$_myTableForPregreplaceOnly->{$matches[1]};
Documentation generated on Tue, 19 Nov 2013 15:15:17 +0100 by phpDocumentor 1.4.3