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

  • AddConditionEvent
  • BuilderEvent
  • CreateConditionEvent
  • CreateDefaultPaletteConditionEvent
  • CreateLegendEvent
  • CreatePaletteCollectionEvent
  • CreatePaletteConditionChainEvent
  • CreatePaletteEvent
  • CreatePropertyConditionChainEvent
  • CreatePropertyEvent
  • CreatePropertyValueConditionEvent
  • FinishConditionEvent
  • FinishLegendEvent
  • FinishPaletteCollectionEvent
  • FinishPaletteEvent
  • FinishPropertyEvent
  • SetDefaultPaletteConditionClassNameEvent
  • SetLegendClassNameEvent
  • SetPaletteClassNameEvent
  • SetPaletteCollectionClassNameEvent
  • SetPaletteConditionChainClassNameEvent
  • SetPalettePropertyValueConditionClassNameEvent
  • SetPropertyClassNameEvent
  • SetPropertyConditionChainClassNameEvent
  • SetPropertyValueConditionClassNameEvent
  • UseLegendEvent
  • UsePaletteCollectionEvent
  • UsePaletteEvent
  • UsePropertyEvent
  • 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\DataDefinition\Palette\Builder\Event;
 14: 
 15: use DcGeneral\DataDefinition\Palette\Condition\Palette\PaletteConditionInterface;
 16: use DcGeneral\DataDefinition\Palette\Condition\Palette\PropertyValueCondition as PalettePropertyValueCondition;
 17: use DcGeneral\DataDefinition\Palette\Condition\Property\PropertyConditionInterface;
 18: use DcGeneral\DataDefinition\Palette\Condition\Property\PropertyValueCondition;
 19: use DcGeneral\DataDefinition\Palette\Builder\PaletteBuilder;
 20: use DcGeneral\DataDefinition\Palette\PaletteInterface;
 21: use DcGeneral\DataDefinition\Palette\PropertyInterface;
 22: use DcGeneral\Exception\DcGeneralInvalidArgumentException;
 23: 
 24: /**
 25:  * This event is emitted when an condition is added by the palette builder.
 26:  *
 27:  * @package DcGeneral\DataDefinition\Palette\Builder\Event
 28:  */
 29: class AddConditionEvent extends BuilderEvent
 30: {
 31:     const NAME = 'dc-general.data-definition.palette.builder.add-condition';
 32: 
 33:     /**
 34:      * The condition that is being added.
 35:      *
 36:      * @var PaletteConditionInterface|PropertyConditionInterface
 37:      */
 38:     protected $condition;
 39: 
 40:     /**
 41:      * The target to which the condition is being added.
 42:      *
 43:      * @var PaletteInterface|PropertyInterface
 44:      */
 45:     protected $target;
 46: 
 47:     /**
 48:      * Create a new instance.
 49:      *
 50:      * @param PaletteConditionInterface|PropertyConditionInterface $condition      The condition being added.
 51:      *
 52:      * @param PaletteInterface|PropertyInterface                   $target         The target property or palette.
 53:      *
 54:      * @param PaletteBuilder                                       $paletteBuilder The palette builder in use.
 55:      */
 56:     public function __construct($condition, $target, PaletteBuilder $paletteBuilder)
 57:     {
 58:         $this->setCondition($condition);
 59:         $this->setTarget($target);
 60:         parent::__construct($paletteBuilder);
 61:     }
 62: 
 63:     /**
 64:      * Set the condition.
 65:      *
 66:      * @param PalettePropertyValueCondition|PropertyValueCondition $condition The condition.
 67:      *
 68:      * @return AddConditionEvent
 69:      *
 70:      * @throws DcGeneralInvalidArgumentException When an invalid condition has been passed.
 71:      */
 72:     public function setCondition($condition)
 73:     {
 74:         if ((!$condition instanceof PaletteConditionInterface) && (!$condition instanceof PropertyConditionInterface))
 75:         {
 76:             throw new DcGeneralInvalidArgumentException();
 77:         }
 78: 
 79:         $this->condition = $condition;
 80:         return $this;
 81:     }
 82: 
 83:     /**
 84:      * Retrieve the condition.
 85:      *
 86:      * @return PalettePropertyValueCondition|PropertyValueCondition
 87:      */
 88:     public function getCondition()
 89:     {
 90:         return $this->condition;
 91:     }
 92: 
 93:     /**
 94:      * Set the target.
 95:      *
 96:      * @param PaletteInterface|PropertyInterface $target The target property or palette.
 97:      *
 98:      * @return AddConditionEvent
 99:      *
100:      * @throws DcGeneralInvalidArgumentException When an invalid target has been passed.
101:      */
102:     public function setTarget($target)
103:     {
104:         if ((!$target instanceof PaletteInterface) && (!$target instanceof PropertyInterface))
105:         {
106:             throw new DcGeneralInvalidArgumentException();
107:         }
108: 
109:         $this->target = $target;
110:         return $this;
111:     }
112: 
113:     /**
114:      * Retrieve the target.
115:      *
116:      * @return PaletteInterface|PropertyInterface
117:      */
118:     public function getTarget()
119:     {
120:         return $this->target;
121:     }
122: }
123: 
contao-community-alliance/dc-general API documentation generated by ApiGen 2.8.0