arfaram/eztagsattributetype

Add new tag attribute type for ezplatform landingpage blocks

Installs: 120

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 2

Open Issues: 0

Type:ezplatform-bundle

v3.0.1 2020-05-03 12:02 UTC

README

This bundle allows you to add a new attribute type tags to the block definition. It requires the NetgenTags Bundle.

You can find the available attribute types in eZPlatform here: https://doc.ezplatform.com/en/latest/extending/extending_page/#creating-custom-page-blocks)

Requirement

  • Ez Platform Enterprise 3+

Installation

composer require arfaram/eztagsattributetype

Add below line to bundles.php

EzPlatform\BlockTagAttributeTypeBundle\EzPlatformBlockTagAttributeTypeBundle::class => ['all' => true],

Usage

Block configuration example:

blocks:
    myblockidentifier:
        #...
        attributes:
            tags:
                type: tags

You can also additional options:

                type: 'tags'
                options:
                    max_tags: 3 # max number of added tags 
                    max_results: 3  # max results in the drop-down list
                    subtree_limit: 513 # restrict access to a specific location in the keywords tree
                    hide_root_tag: true # hide root tag
                    edit_view: 'Default' # or 'Select'. ('Default' per default)
  • Default View

tags_attribute_type.png

  • Select View

tags_attribute_type_select_view.png

Below is an example on how to access the data in a custom BlockListener.

$blockValue = $event->getBlockValue();
$tagsValue = json_decode($blockValue->getAttribute('tags')->getValue(), true);

Example: Profiler Block

https://github.com/arfaram/ezprofilerblock