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: use DcGeneral\Contao\View\Contao2BackendView\Event\GetPasteRootButtonEvent;
16: use DcGeneral\DC_General;
17: 
18: /**
19:  * Class ContainerPasteRootButtonCallbackListener.
20:  *
21:  * Handler for the paste into root buttons.
22:  *
23:  * @package DcGeneral\Contao\Callback
24:  */
25: class ContainerPasteRootButtonCallbackListener extends AbstractReturningCallbackListener
26: {
27:     /**
28:      * The DC_General instance.
29:      *
30:      * @var DC_General
31:      */
32:     protected $dcGeneral;
33: 
34:     /**
35:      * Create a new instance of the listener.
36:      *
37:      * @param array|callable $callback  The callback to call when invoked.
38:      *
39:      * @param DC_General     $dcGeneral The DC_General instance to use in the callback.
40:      */
41:     public function __construct($callback, DC_General $dcGeneral)
42:     {
43:         parent::__construct($callback);
44:         $this->dcGeneral = $dcGeneral;
45:     }
46: 
47:     /**
48:      * Retrieve the arguments for the callback.
49:      *
50:      * @param GetPasteRootButtonEvent $event The event being emitted.
51:      *
52:      * @return array
53:      */
54:     public function getArgs($event)
55:     {
56:         return array(
57:             $this->dcGeneral,
58:             $event->getEnvironment()->getDataProvider()->getEmptyModel()->getPropertiesAsArray(),
59:             $event->getEnvironment()->getDataDefinition()->getName(),
60:             false,
61:             $event->getEnvironment()->getClipboard()->getContainedIds(),
62:             null,
63:             null
64:         );
65:     }
66: 
67:     /**
68:      * Set the HTML code for the button.
69:      *
70:      * @param GetPasteRootButtonEvent $event The event being emitted.
71:      *
72:      * @param string                  $value The value returned by the callback.
73:      *
74:      * @return void
75:      */
76:     public function update($event, $value)
77:     {
78:         if (is_null($value))
79:         {
80:             return;
81:         }
82: 
83:         $event->setHtml($value);
84:         $event->stopPropagation();
85:     }
86: }
87: 
contao-community-alliance/dc-general API documentation generated by ApiGen 2.8.0