Joomla Platform
13.1
Documentation des API du framework Joomla Platform
Page principale
Pages associées
Espaces de nommage
Classes
Fichiers
Exemples
Liste des fichiers
Membres de fichier
Tout
Classes
Espaces de nommage
Fichiers
Fonctions
Variables
Pages
interface.php
Aller à la documentation de ce fichier.
1
<?php
2
/**
3
* @package Joomla.Platform
4
* @subpackage Observer
5
*
6
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
7
* @license GNU General Public License version 2 or later; see LICENSE
8
*/
9
10
defined(
'JPATH_PLATFORM'
) or die;
11
12
/**
13
* Observer pattern interface for Joomla
14
*
15
* A class that wants to observe another class must:
16
*
17
* 1) Add: implements JObserverInterface
18
* to its class
19
*
20
* 2) Implement a constructor, that can look like this:
21
* public function __construct(JObservableInterface $observableObject)
22
* {
23
* $observableObject->attachObserver($this);
24
* $this->observableObject = $observableObject;
25
* }
26
*
27
* 3) and must implement the instanciator function createObserver() below, e.g. as follows:
28
* public static function createObserver(JObservableInterface $observableObject, $params = array())
29
* {
30
* $observer = new self($observableObject);
31
* $observer->... = $params['...']; ...
32
* return $observer;
33
* }
34
*
35
* 4) Then add functions corresponding to the events to be observed,
36
* E.g. to respond to event: $this->_observers->update('onBeforeLoad', array($keys, $reset));
37
* following function is needed in the obser:
38
* public function onBeforeLoad($keys, $reset) { ... }
39
*
40
* 5) Finally, the binding is made outside the observable and observer classes, using:
41
* JObserverMapper::addObserverClassToClass('ObserverClassname', 'ObservableClassname', array('paramName' => 'paramValue'));
42
* where the last array will be provided to the observer instanciator function createObserver.
43
*
44
* @package Joomla.Platform
45
* @subpackage Observer
46
* @link http://docs.joomla.org/JObserverInterface
47
* @since 3.1.2
48
*/
49
interface
JObserverInterface
50
{
51
/**
52
* Creates the associated observer instance and attaches it to the $observableObject
53
*
54
* @param JObservableInterface $observableObject The observable subject object
55
* @param array $params Params for this observer
56
*
57
* @return JObserverInterface
58
*
59
* @since 3.1.2
60
*/
61
public
static
function
createObserver(
JObservableInterface
$observableObject, $params = array());
62
}
Documentation et API générés le 16/11/2013 par l'équipe
Dev.joomla.fr
de l'
AFUJ
avec la solution