NAME

Strehler::Manual::ExtraEntityConfiguration - Configurable flags on extra entities

DESCRIPTION

The behaviour of Strehler when it manages an extra entity can be highly customized just using standard Strehler flags. These flags will be listed here and explained.

CONFIGURE A FLAG

There're two ways to assign a custom value to a flag related to an extra entity.

ENTITY CLASS FLAG METHOD OVERRIDE

In the new entity class you can override methods that belong to Strehler::Element::Role::Configured to make them return flag value you want. For example:

sub updatable { return 0; }

will make your entity elements impossible to be modified, turning off the "Edit" button.

STREHLER CONFIGURATION

Standard implementation of configuration methods just try to read the flag from the config.yml or return a default value. So you can use Dancer2 configuration to change values.

Strehler:
    my_entity:
        auto: 1
        class: My::Entity
        deletable: 0

My_entity will not have delete button on its entries.

REMEMBER: Overriding configuration methods has always priority on config.yml configuration.

CONFIGURATION FLAGS

auto

default: 1

Tell Strehler to use standard implementation for all the backend navigations. With auto = 0, paths like /admin/entity/list have to be implemented.

exposed

default: 1

Data about the entity is automatically exposed through Strehler's APIs.

plural

default: a label deriver from item_type using Lingua::EN::Inflect

Label that will be used to build API paths.

label

default: ???

The label that will appear in the menu and in the entity pages.

class

Mandatory in config.yml

Indicates the class that will manage the entity (a "Strehler::Element subclass").

form

default: undef

Say the file with the form configuration for the CRUD of the entity. If no form is defined create/update functions will fail.

multilang_form

default: undef

As for form flag, defines the file with multilang fields configuration. TO be used only if you have multilang fields.

creatable

default: 1

Say if Strehler user can create an entry for the entity.

updatable

default: 1

Say if Strehler user can modify an entry for the entity.

deletable

default: 1

Say if Strehler user can delete an entry for the entity.

categorized

default: 0

Say if entity can be categorized using Strehler categories. To be categorized, the entity must have a column CATEGORY (INTEGER) in its database table.

To add category selector to your form use Strehler::FormFu::Element::Category. Just add:

- type: "+Strehler::FormFu::Element::Category"

to your form. For tags use Strehler::FormFu::Element::Tags.

- type: "+Strehler::FormFu::Element::Tags"
ordered

default: 0

Say if entity uses Strehler ordering feature. To use it, the entity must ave a column DISPLAY_ORDER (INTEGER) in its database table.

To add order field (with Next! button) to your form use Strehler::FormFu::Element::DisplayOrder

- type: "+Strehler::FormFu::Element::DisplayOrder"
dated

default: 0

Say if entity uses Strehler publish date feature. To use it, the entity must ave a column PUBLISH_DATE (DATE) in its database table.

To add order field (with Next! button) to your form use Strehler::FormFu::Element::PublishDate

- type: "+Strehler::FormFu::Element::PublishDate"
publishable

default: 0

Say if entity uses Strehler publish feature To use it, the entity must ave a column PUBLISHED (TINYINT) in its database table.

custom_list_view

default: generic list view as in the Strehler package

Let you use a different view for listing entity entries. Entries will be passed to the view as "elements" array, with all the basic data of the entity.

allowed_role

default: ""

If role is equal to admin only admin user will see the entity.

SEE ALSO

Strehler::Manual::ExtraEntityTutorial explains how to create a new entity and how configuration flags will be used.