• Alt-text, title, image source, and link url can be editable
Check out the DML Documentation to see a full list of attributes that can be used to customize each of these elements
One of the benefits of DML is the ability to edit your block content without touching the underlying code when building a template. Use these attributes to define what content can be changed in the template editor:
• Makes elements available to be changed in the visual editor
• Required to use the next two attributes
• Each editable attribute requires a name that is unique to the block.
• Lets you specify which fields should be editable and which should be locked
• Allows certain styles of an element to be changed in the visual editor
Putting it all Together
Check out this sample block in the DML Playground to see the DML we’ve covered so far in action.
This image's source url, alt text, and href will be editable in
the visual editor
<dys-img src='http://placekitten.com/500/350' editable='image'/>
The content and color of this title will be editable.
<dys-title editable-styles='color' editable='title'>
Because this doesn't have an editable attribute, it cannot be changed
in the visual editor.
By defining editable-fields as href, only the link will be editable,
not the content.
Setting the editable-styles will allow the text and background colors to
be changed in the editor
<dys-button align='left' editable-fields='href'
How does it look in the editor?
With the editable fields set in this example, this is what you would see if you were editing this block in a template:
This example block is also a good opportunity to practice modifying these elements. Some things to try include:
• Change the background-color of the row
• Change the color and background-color of your button
• Set the left column’s width to 25% and both columns’ vertical-align to middle
• Try setting different values for padding in some of your elements