MetaModels\DcGeneral\DataDefinition\Palette\Condition\Property\IsVariantAttribute::match PHP Method

match() public method

public match ( ContaoCommunityAlliance\DcGeneral\Data\ModelInterface $model = null, ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBag $input = null, ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PropertyInterface $property = null, ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\LegendInterface $legend = null )
$model ContaoCommunityAlliance\DcGeneral\Data\ModelInterface
$input ContaoCommunityAlliance\DcGeneral\Data\PropertyValueBag
$property ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\PropertyInterface
$legend ContaoCommunityAlliance\DcGeneral\DataDefinition\Palette\LegendInterface
    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;
    }
IsVariantAttribute