[NPMCLI-132] Command "create-block" Created: 21/Apr/17  Updated: 14/Feb/18  Resolved: 01/Dec/17

Status: Closed
Project: Magnolia CLI
Component/s: None
Affects Version/s: None
Fix Version/s: 3.0.0

Type: New Feature Priority: Neutral
Reporter: Christoph Meier Assignee: Jaroslav Simak
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
duplicate
is duplicated by NPMCLI-136 Create content editor block Closed
Template:
Acceptance criteria:
Empty
Date of First Response:
Epic Link: CLI v3
Sprint: Kromeriz 124, Kromeriz 125
Story Points: 5

 Description   

Creating a block requires a few files which are linked, the task is very similar to create-page or create-component.
I propose the following command:

mgnl create-block <blockName> [-p <path>]

<blockName>:
The name of the new block.

-p <path>
The path to the light module to add the new block to.
If the parameter is omitted, the command must be run within an existing light module folder.

The command should create these files:

  • <light-module>/blocks/<blockName>.yaml
  • <light-module>/templates/blocks/<blockName>.yaml
  • <light-module>/templates/blocks/<blockName>.ftl

The defaults (prototypes) of the block definition (fields!) and the template script to render them needs discussion.



 Comments   
Comment by Jaroslav Simak [ 28/Nov/17 ]

cmeier czimmermann

The defaults (prototypes) of the block definition (fields!) and the template script to render them needs discussion.

What fields do we want to include in custom block definition? Can i include those fields that are mentioned in the documentation?

Comment by Christopher Zimmermann [ 28/Nov/17 ]

I would base it on the FieldSetBlockDefinition.
(https://documentation.magnolia-cms.com/display/DOCS56/Block+definition)
How about including all the same ones as mgnl create component? Then a user has a working block that does everything and can then delete the things they don't need.
I would also supply an icon - maybe "node-data"

Comment by Roman Kovařík [ 04/Dec/17 ]
    
<a href='${ctx.contextPath}/${cmsfn.link(target)!}' class='btn btn-link'>${target.title!target.@name}</a>

produces: http://localhost:8080/magnoliaTest//magnoliaTest/travel/

Generated at Mon Feb 12 04:46:50 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.