AllowHtml example

protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new StringField('name', 'name'))->addFlags(new ApiAware()new Required()),
            (new BreadcrumbField())->addFlags(new ApiAware()new WriteProtected()),
            new JsonField('slot_config', 'slotConfig'),
            (new StringField('link_type', 'linkType'))->addFlags(new ApiAware()),
            (new IdField('internal_link', 'internalLink'))->addFlags(new ApiAware()),
            (new StringField('external_link', 'externalLink'))->addFlags(new ApiAware()),
            (new BoolField('link_new_tab', 'linkNewTab'))->addFlags(new ApiAware()),
            (new LongTextField('description', 'description'))->addFlags(new ApiAware()new AllowHtml()),
            (new LongTextField('meta_title', 'metaTitle'))->addFlags(new ApiAware()new AllowHtml()),
            (new LongTextField('meta_description', 'metaDescription'))->addFlags(new ApiAware()new AllowHtml()),
            (new LongTextField('keywords', 'keywords'))->addFlags(new ApiAware()new AllowHtml()),
            (new CustomFields())->addFlags(new ApiAware()),
        ]);
    }
}

    public static function stringFieldDataProvider(): array
    {
        return [
            ['writeException', '<test>', 'This value should not be blank.', [new Required()]],
            ['writeException', null, 'This value should not be blank.', [new Required()]],
            ['writeException', '', 'This value should not be blank.', [new Required()]],
            ['writeException', true, 'This value should be of type string.', [new Required()]],
            ['assertion', 'test12-B', 'test12-B', [new Required()]],
            ['assertion', null, null, []],
            ['assertion', '<test>', '<test>', [new Required()new AllowHtml(false)]],
            ['assertion', '', null, []],
            ['assertion', '', '', [new AllowEmptyString()]],
            ['assertion', '', '', [new Required()new AllowEmptyString()]],
            ['assertion', '<script></script>test12-B', 'test12-B', [new Required()new AllowHtml()]],
        ];
    }

    private function getWriteParameterBagMock(): WriteParameterBag
    {
        $mockBuilder = $this->getMockBuilder(WriteParameterBag::class);
        $mockBuilder->disableOriginalConstructor();

        
protected function getParentDefinitionClass(): string
    {
        return CustomerGroupDefinition::class;
    }

    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new StringField('name', 'name'))->addFlags(new ApiAware()new Required()),
            (new StringField('registration_title', 'registrationTitle'))->addFlags(new ApiAware()),
            (new LongTextField('registration_introduction', 'registrationIntroduction'))->addFlags(new ApiAware()new AllowHtml()),
            (new BoolField('registration_only_company_registration', 'registrationOnlyCompanyRegistration'))->addFlags(new ApiAware()),
            (new LongTextField('registration_seo_meta_description', 'registrationSeoMetaDescription'))->addFlags(new ApiAware()),
            (new CustomFields())->addFlags(new ApiAware()),
        ]);
    }
}
protected function getParentDefinitionClass(): string
    {
        return LandingPageDefinition::class;
    }

    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new StringField('name', 'name'))->addFlags(new ApiAware()new Required()),
            (new StringField('url', 'url'))->addFlags(new ApiAware()new Required()),
            (new JsonField('slot_config', 'slotConfig'))->addFlags(new ApiAware()),
            (new LongTextField('meta_title', 'metaTitle'))->addFlags(new ApiAware()new AllowHtml()),
            (new LongTextField('meta_description', 'metaDescription'))->addFlags(new ApiAware()new AllowHtml()),
            (new LongTextField('keywords', 'keywords'))->addFlags(new ApiAware()new AllowHtml()),
            (new CustomFields())->addFlags(new ApiAware()),
        ]);
    }
}
$type = $this->getCustomFields()[$attributeName] ?? null;
        if (!$type) {
            return null;
        }

        return match ($type) {
            CustomFieldTypes::INT => (new IntField($attributeName$attributeName))->addFlags(new ApiAware()),
            CustomFieldTypes::FLOAT => (new FloatField($attributeName$attributeName))->addFlags(new ApiAware()),
            CustomFieldTypes::BOOL => (new BoolField($attributeName$attributeName))->addFlags(new ApiAware()),
            CustomFieldTypes::DATETIME => (new DateTimeField($attributeName$attributeName))->addFlags(new ApiAware()),
            CustomFieldTypes::TEXT => (new LongTextField($attributeName$attributeName))->addFlags(new ApiAware()),
            CustomFieldTypes::HTML => (new LongTextField($attributeName$attributeName))->addFlags(new ApiAware()new AllowHtml()),
            CustomFieldTypes::PRICE => (new PriceField($attributeName$attributeName))->addFlags(new ApiAware()),
            default => (new JsonField($attributeName$attributeName))->addFlags(new ApiAware()),
        };
    }

    /** * @return array<string, string> */
    public static function getSubscribedEvents(): array
    {
        return [
            


    protected function getParentDefinitionClass(): string
    {
        return ProductManufacturerDefinition::class;
    }

    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new StringField('name', 'name'))->addFlags(new ApiAware()new Required()),
            (new LongTextField('description', 'description'))->addFlags(new ApiAware()new AllowHtml()),
            (new CustomFields())->addFlags(new ApiAware()),
        ]);
    }
}
return AppDefinition::class;
    }

    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new IdField('id', 'id'))->addFlags(new PrimaryKey()new Required()),
            (new StringField('identifier', 'identifier'))->addFlags(new Required()),
            new TranslatedField('name'),
            (new BoolField('active', 'active'))->addFlags(new Required()),
            new StringField('group', 'group'),
            (new LongTextField('script', 'script'))->addFlags(new AllowHtml(false)),
            (new BlobField('constraints', 'constraints'))->removeFlag(ApiAware::class)->addFlags(new WriteProtected(Context::SYSTEM_SCOPE)),
            new JsonField('config', 'config'),
            (new FkField('app_id', 'appId', AppDefinition::class))->addFlags(new CascadeDelete()new Required()),
            new ManyToOneAssociationField('app', 'app_id', AppDefinition::class),
            (new OneToManyAssociationField('ruleConditions', RuleConditionDefinition::class, 'script_id', 'id'))->addFlags(new SetNullOnDelete()),
            (new TranslationsAssociationField(AppScriptConditionTranslationDefinition::class, 'app_script_condition_id'))->addFlags(new Required()),
        ]);
    }
}
protected function getParentDefinitionClass(): string
    {
        return MailHeaderFooterDefinition::class;
    }

    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new StringField('name', 'name'))->addFlags(new Required()),
            (new StringField('description', 'description'))->addFlags(new ApiAware()),
            (new LongTextField('header_html', 'headerHtml'))->addFlags(new ApiAware()new AllowHtml()),
            (new LongTextField('header_plain', 'headerPlain'))->addFlags(new ApiAware()),
            (new LongTextField('footer_html', 'footerHtml'))->addFlags(new ApiAware()new AllowHtml()),
            (new LongTextField('footer_plain', 'footerPlain'))->addFlags(new ApiAware()),
        ]);
    }
}
protected function getParentDefinitionClass(): string
    {
        return SalesChannelTypeDefinition::class;
    }

    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new StringField('name', 'name'))->addFlags(new Required()),
            new StringField('manufacturer', 'manufacturer'),
            new StringField('description', 'description'),
            (new LongTextField('description_long', 'descriptionLong'))->addFlags(new ApiAware()new AllowHtml()),
            new CustomFields(),
        ]);
    }
}


    public function since(): ?string
    {
        return '6.3.1.0';
    }

    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new IdField('id', 'id'))->addFlags(new PrimaryKey()new Required()),
            (new LongTextField('template', 'template'))->addFlags(new Required()new AllowHtml(false)new AllowEmptyString()),
            (new StringField('path', 'path', 1024))->addFlags(new Required()),
            (new BoolField('active', 'active'))->addFlags(new Required()),
            (new FkField('app_id', 'appId', AppDefinition::class))->addFlags(new Required()),
            new ManyToOneAssociationField('app', 'app_id', AppDefinition::class),
        ]);
    }
}
new DAL\OneToManyAssociationField('comments', 'ce_blog_comment', 'custom_entity_blog_comments_id', 'id'))->addFlags(new DAL\Flag\CascadeDelete()),

                (new ManyToManyAssociationField('inheritedProducts', 'product', 'custom_entity_blog_inherited_products', 'custom_entity_blog_id', 'product_id', 'id', 'id'))->addFlags(new DAL\Flag\CascadeDelete()new DAL\Flag\ReverseInherited('customEntityBlogInheritedProducts')),

                new FkField('inherited_top_seller_id', 'inheritedTopSellerId', 'product', 'id'),
                (new DAL\ManyToOneAssociationField('inheritedTopSeller', 'inherited_top_seller_id', 'product', 'id'))->addFlags(new DAL\Flag\ReverseInherited('customEntityBlogInheritedTopSeller')),
            ],
            'custom_entity_blog_translation' => [
                (new FkField('custom_entity_blog_id', 'customEntityBlogId', 'custom_entity_blog'))->addFlags(new Required()new PrimaryKey()),
                (new FkField('language_id', 'languageId', 'language'))->addFlags(new Required()new PrimaryKey()),
                (new DAL\StringField('title', 'title'))->addFlags(new Required()),
                (new DAL\LongTextField('content', 'content'))->addFlags(new DAL\Flag\AllowHtml()),
                new DAL\BoolField('display', 'display'),
            ],
            'product' => [
                (new ManyToManyAssociationField('customEntityBlogProducts', 'custom_entity_blog', 'custom_entity_blog_products', 'product_id', 'custom_entity_blog_id', 'id', 'id'))->addFlags(new DAL\Flag\CascadeDelete()new Extension()),
                (new DAL\OneToOneAssociationField('customEntityBlogLinkProductRestrict', 'id', 'link_product_restrict_id', 'custom_entity_blog'))->addFlags(new DAL\Flag\RestrictDelete()new Extension()),
                (new DAL\OneToOneAssociationField('customEntityBlogLinkProductCascade', 'id', 'link_product_cascade_id', 'custom_entity_blog'))->addFlags(new DAL\Flag\CascadeDelete()new Extension()),
                (new DAL\OneToOneAssociationField('customEntityBlogLinkProductSetNull', 'id', 'link_product_set_null_id', 'custom_entity_blog'))->addFlags(new DAL\Flag\SetNullOnDelete()new Extension()),
                (new OneToManyAssociationField('customEntityBlogTopSellerCascade', 'custom_entity_blog', 'top_seller_cascade_id'))->addFlags(new DAL\Flag\CascadeDelete()new Extension()),
                (new OneToManyAssociationField('customEntityBlogTopSellerRestrict', 'custom_entity_blog', 'top_seller_restrict_id'))->addFlags(new DAL\Flag\RestrictDelete()new Extension()),
                (new OneToManyAssociationField('customEntityBlogTopSellerSetNull', 'custom_entity_blog', 'top_seller_set_null_id'))->addFlags(new DAL\Flag\SetNullOnDelete()new Extension()),
                (new ManyToManyAssociationField('customEntityBlogInheritedProducts', 'custom_entity_blog', 'custom_entity_blog_inherited_products', 'product_id', 'custom_entity_blog_id', 'id', 'id'))->addFlags(new DAL\Flag\CascadeDelete()new Extension()new DAL\Flag\Inherited()),
                (
protected function getParentDefinitionClass(): string
    {
        return ProductDefinition::class;
    }

    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new StringField('meta_description', 'metaDescription'))->addFlags(new ApiAware()),
            (new StringField('name', 'name'))->addFlags(new ApiAware()new Required()),
            (new LongTextField('keywords', 'keywords'))->addFlags(new ApiAware()),
            (new LongTextField('description', 'description'))->addFlags(new ApiAware()new AllowHtml()),
            (new StringField('meta_title', 'metaTitle'))->addFlags(new ApiAware()),
            (new StringField('pack_unit', 'packUnit'))->addFlags(new ApiAware()),
            (new StringField('pack_unit_plural', 'packUnitPlural'))->addFlags(new ApiAware()),
            new ListField('custom_search_keywords', 'customSearchKeywords'),
            (new JsonField('slot_config', 'slotConfig'))->addFlags(new ApiAware()),
            (new CustomFields())->addFlags(new ApiAware()),
        ]);
    }
}
new FkField('sales_channel_id', 'salesChannelId', SalesChannelDefinition::class))->addFlags(new Required()),
            (new FkField('sales_channel_domain_id', 'salesChannelDomainId', SalesChannelDomainDefinition::class))->addFlags(new Required()),
            (new FkField('currency_id', 'currencyId', CurrencyDefinition::class))->addFlags(new Required()),
            (new StringField('file_name', 'fileName'))->addFlags(new Required()),
            (new StringField('access_key', 'accessKey'))->addFlags(new Required()),
            (new StringField('encoding', 'encoding'))->addFlags(new Required()),
            (new StringField('file_format', 'fileFormat'))->addFlags(new Required()),
            new BoolField('include_variants', 'includeVariants'),
            (new BoolField('generate_by_cronjob', 'generateByCronjob'))->addFlags(new Required()),
            new DateTimeField('generated_at', 'generatedAt'),
            (new IntField('interval', 'interval'))->addFlags(new Required()),
            (new LongTextField('header_template', 'headerTemplate'))->addFlags(new AllowHtml(false)),
            (new LongTextField('body_template', 'bodyTemplate'))->addFlags(new AllowHtml(false)),
            (new LongTextField('footer_template', 'footerTemplate'))->addFlags(new AllowHtml(false)),
            new BoolField('paused_schedule', 'pausedSchedule'),
            new BoolField('is_running', 'isRunning'),
            new ManyToOneAssociationField('productStream', 'product_stream_id', ProductStreamDefinition::class, 'id', false),
            new ManyToOneAssociationField('storefrontSalesChannel', 'storefront_sales_channel_id', SalesChannelDefinition::class, 'id', false),
            new ManyToOneAssociationField('salesChannel', 'sales_channel_id', SalesChannelDefinition::class, 'id', false),
            new ManyToOneAssociationField('salesChannelDomain', 'sales_channel_domain_id', SalesChannelDomainDefinition::class, 'id', false),
            new ManyToOneAssociationField('currency', 'currency_id', CurrencyDefinition::class, 'id', false),
        ]);
    }
}
protected function getParentDefinitionClass(): string
    {
        return MailTemplateDefinition::class;
    }

    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new StringField('sender_name', 'senderName'))->addFlags(new ApiAware()),
            (new LongTextField('description', 'description'))->addFlags(new ApiAware()),
            (new StringField('subject', 'subject'))->addFlags(new Required()new AllowHtml(false)),
            (new LongTextField('content_html', 'contentHtml'))->addFlags(new Required()new AllowHtml(false)),
            (new LongTextField('content_plain', 'contentPlain'))->addFlags(new Required()new AllowHtml(false)),
            (new CustomFields())->addFlags(new ApiAware()),
        ]);
    }
}
$collection->add(
                    (new EmailField($name$property))
                        ->addFlags(...$flags)
                );

                break;
            case 'text':
                $instance = (new LongTextField($name$property))
                    ->addFlags(...$flags);

                if ($field['allowHtml'] ?? false) {
                    $instance->addFlags(new AllowHtml(true));
                }

                $collection->add($instance);

                break;
            case 'price':
                $collection->add(
                    (new PriceField($name$property))
                        ->addFlags(...$flags)
                );

                
Home | Imprint | This part of the site doesn't use cookies.