Menu
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version
Publication date

Mar 9, 2022

Confidentiality
Public
Reactions
1
Share

EntityAction

Developer-facing builder for a single entity menu action.

A plugin returns a list of these from get_actions. Use the classmethod helpers (:meth:button, :meth:link) rather than building one directly.

Attributes
action_name: str | Nonechildren: list[EntityAction] | Nonecolor: EntityActionColor | Nonedisabled: booldivider: boolicon: str | Nonekind: EntityActionKindlink_url: str | Nonetext: str
Functions
__init__

Build an entity action. Prefer the :meth:button / :meth:link classmethod helpers over calling this directly.

kind : EntityActionKind
the action kind (button or link).
text : str
the literal text displayed in the menu (no translation).
icon : str | None
optional Material icon name shown before the text.
divider : bool - False
if True, a divider is rendered before the action.
color : EntityActionColor | None
optional color of the menu item ('primary', 'accent' or 'warn'). Defaults to the standard menu item color.
action_name : str | None
button only - short, plugin-local action name.
disabled : bool - False
button only - if True, the button is disabled.
children : list[EntityAction] | None
button only - optional nested sub-menu actions.
link_url : str | None
link only - the internal route the link points to.
to_dto

Convert to the DTO sent to the front.

Button action_name is namespaced as <plugin_id>.<action_name>, where plugin_id is itself <brick_name>.<plugin_name>.

plugin_id : str
the globally unique id of the owning plugin, used to namespace the action name of button actions.
Return type : EntityActionMenuDTO
button @classmethod

Build a button action. Clicking it calls back the owning plugin.

action_name : str
short, plugin-local action name. It is namespaced with the plugin id when converted to a DTO so the dispatch endpoint can route it back to the owning plugin. Must not contain a dot.
text : str
the literal text displayed on the button (no translation).
icon : str | None
optional Material icon name shown before the text.
divider : bool - False
if True, a divider is rendered before the button.
disabled : bool - False
if True, the button is rendered disabled.
color : EntityActionColor | None
optional color of the button ('primary', 'accent' or 'warn'). Defaults to the standard menu item color.
children : list[EntityAction] | None
optional nested actions rendered as a sub-menu.
Return type : EntityAction
Shine Logo
Technical bricks to reuse or customize

Have you developed a brick?

Share it to accelerate projects for the entire community.