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

  • BackendViewPopulator
  • DataProviderPopulator
  • ExtendedLegacyDcaPopulator
  • HardCodedPopulator
  • 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\Dca\Populator;
14: 
15: use DcGeneral\Clipboard\DefaultClipboard;
16: use DcGeneral\Contao\InputProvider;
17: use DcGeneral\Controller\DefaultController;
18: use DcGeneral\EnvironmentInterface;
19: use DcGeneral\EnvironmentPopulator\AbstractEventDrivenEnvironmentPopulator;
20: use DcGeneral\Contao\View\Contao2BackendView;
21: 
22: /**
23:  * Class HardCodedPopulator.
24:  *
25:  * This class only exists to have some intermediate hardcoded transition point until the builder ans populators have
26:  * been properly coded. This class will then be removed from the code base.
27:  *
28:  * @package DcGeneral\Contao\Dca\Populator
29:  */
30: class HardCodedPopulator extends AbstractEventDrivenEnvironmentPopulator
31: {
32:     const PRIORITY = 1000;
33: 
34:     /**
35:      * Create a controller instance in the environment if none has been defined yet.
36:      *
37:      * @param EnvironmentInterface $environment The environment to populate.
38:      *
39:      * @return void
40:      *
41:      * @internal
42:      */
43:     public function populateController(EnvironmentInterface $environment)
44:     {
45:         // Already populated, get out then.
46:         if ($environment->getController())
47:         {
48:             return;
49:         }
50: 
51:         $controller = new DefaultController();
52: 
53:         $controller->setEnvironment($environment);
54:         $environment->setController($controller);
55:     }
56: 
57:     /**
58:      * {@inheritDoc}
59:      */
60:     public function populate(EnvironmentInterface $environment)
61:     {
62:         if (!$environment->getInputProvider())
63:         {
64:             $environment->setInputProvider(new InputProvider());
65:         }
66: 
67:         if (!$environment->getClipboard())
68:         {
69:             $environment->setClipboard(new DefaultClipboard());
70:         }
71: 
72:         $this->populateController($environment);
73:     }
74: }
75: 
contao-community-alliance/dc-general API documentation generated by ApiGen 2.8.0