コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function match(ModelInterface $model = null, PropertyValueBag $input = null, PropertyInterface $property = null, LegendInterface $legend = null)
 {
     if ($property === null) {
         return false;
     }
     /** @var $model \MetaModels\DcGeneral\Data\Model */
     $nativeItem = $model->getItem();
     $metaModel = $nativeItem->getMetaModel();
     if ($metaModel->hasVariants() && !$nativeItem->isVariantBase()) {
         return !in_array($property->getName(), array_keys($metaModel->getInVariantAttributes()));
     }
     return true;
 }
コード例 #2
0
ファイル: Subscriber.php プロジェクト: metamodels/core
 /**
  * Add a visible condition.
  *
  * @param PropertyInterface  $property  The property.
  *
  * @param ConditionInterface $condition The condition to add.
  *
  * @return void
  */
 protected function addCondition(PropertyInterface $property, ConditionInterface $condition)
 {
     $chain = $property->getVisibleCondition();
     if (!($chain && $chain instanceof PropertyConditionChain && $chain->getConjunction() == PropertyConditionChain::AND_CONJUNCTION)) {
         if ($property->getVisibleCondition()) {
             $previous = array($property->getVisibleCondition());
         } else {
             $previous = array();
         }
         $chain = new PropertyConditionChain($previous, PropertyConditionChain::AND_CONJUNCTION);
         $property->setVisibleCondition($chain);
     }
     $chain->addCondition($condition);
 }
コード例 #3
0
ファイル: Subscriber.php プロジェクト: zonky2/core
 /**
  * Add a condition to a property.
  *
  * @param PropertyInterface  $property  The property.
  *
  * @param ConditionInterface $condition The condition to add.
  *
  * @return void
  */
 protected function addCondition($property, $condition)
 {
     $currentCondition = $property->getVisibleCondition();
     if (!$currentCondition instanceof ConditionChainInterface || $currentCondition->getConjunction() != ConditionChainInterface::OR_CONJUNCTION) {
         if ($currentCondition === null) {
             $currentCondition = new PropertyConditionChain(array($condition));
         } else {
             $currentCondition = new PropertyConditionChain(array($currentCondition, $condition));
         }
         $currentCondition->setConjunction(ConditionChainInterface::OR_CONJUNCTION);
         $property->setVisibleCondition($currentCondition);
     } else {
         $currentCondition->addCondition($condition);
     }
 }