Overview

Namespaces

  • DcGeneral
    • Clipboard
    • Contao
      • Callback
      • Compatibility
      • DataDefinition
        • Definition
      • Dca
        • Builder
          • Legacy
        • Definition
        • Palette
        • Populator
      • Event
      • View
        • Contao2BackendView
          • Event
    • Controller
    • Data
    • DataDefinition
      • Builder
      • Definition
        • Properties
        • View
          • Panel
      • ModelRelationship
      • Palette
        • Builder
          • Event
        • Condition
          • Palette
          • Property
    • EnvironmentPopulator
    • Event
    • Exception
    • Factory
      • Event
    • Panel
    • View
      • Event

Classes

  • AbstractCallbackListener
  • AbstractReturningCallbackListener
  • AbstractStaticCallbackListener
  • Callbacks
  • ContainerGetBreadcrumbCallbackListener
  • ContainerGlobalButtonCallbackListener
  • ContainerHeaderCallbackListener
  • ContainerOnCopyCallbackListener
  • ContainerOnCutCallbackListener
  • ContainerOnDeleteCallbackListener
  • ContainerOnLoadCallbackListener
  • ContainerOnSubmitCallbackListener
  • ContainerPasteButtonCallbackListener
  • ContainerPasteRootButtonCallbackListener
  • ModelChildRecordCallbackListener
  • ModelGroupCallbackListener
  • ModelLabelCallbackListener
  • ModelOperationButtonCallbackListener
  • ModelOptionsCallbackListener
  • PropertyInputFieldCallbackListener
  • PropertyInputFieldGetWizardCallbackListener
  • PropertyOnLoadCallbackListener
  • PropertyOnSaveCallbackListener
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: /**
 3:  * PHP version 5
 4:  * @package    generalDriver
 5:  * @author     Christian Schiffler <c.schiffler@cyberspectrum.de>
 6:  * @author     Stefan Heimes <stefan_heimes@hotmail.com>
 7:  * @author     Tristan Lins <tristan.lins@bit3.de>
 8:  * @copyright  The MetaModels team.
 9:  * @license    LGPL.
10:  * @filesource
11:  */
12: 
13: namespace DcGeneral\Contao\Callback;
14: 
15: /**
16:  * Class AbstractCallbackListener.
17:  *
18:  * Abstract base class for a callback listener.
19:  *
20:  * @package DcGeneral\Contao\Callback
21:  */
22: abstract class AbstractCallbackListener
23: {
24:     /**
25:      * The callback to use.
26:      *
27:      * @var array|callable
28:      */
29:     protected $callback;
30: 
31:     /**
32:      * Create a new instance of the listener.
33:      *
34:      * @param array|callable $callback The callback to call when invoked.
35:      */
36:     public function __construct($callback = null)
37:     {
38:         $this->callback = $callback;
39:     }
40: 
41:     /**
42:      * Retrieve the attached callback.
43:      *
44:      * @return array|callable
45:      */
46:     public function getCallback()
47:     {
48:         return $this->callback;
49:     }
50: 
51:     /**
52:      * Retrieve the arguments for the callback.
53:      *
54:      * @param \Symfony\Component\EventDispatcher\Event $event The event being emitted.
55:      *
56:      * @return array
57:      */
58:     abstract public function getArgs($event);
59: 
60:     /**
61:      * Invoke the callback.
62:      *
63:      * @param \Symfony\Component\EventDispatcher\Event $event The Event for which the callback shall be invoked.
64:      *
65:      * @return void
66:      */
67:     public function __invoke($event)
68:     {
69:         if ($this->getCallback())
70:         {
71:             Callbacks::callArgs($this->getCallback(), $this->getArgs($event));
72:         }
73:     }
74: }
75: 
contao-community-alliance/dc-general API documentation generated by ApiGen 2.8.0