dnadesign / silverstripe-elemental-list

Group Content Blocks into a Single Block
BSD 3-Clause "New" or "Revised" License
8 stars 12 forks source link

allowed_elements in List Block ? #27

Open MightyMerio opened 5 years ago

MightyMerio commented 5 years ago

Is there a way or possibility to have a way to limit the elements that the elemental list can use in that ElementalArea editor?

eg:


DNADesign\ElementalList\Model\ElementalList:
  inline_editable: false
  allowed_elements:
    - DNADesign\Elemental\Models\ElementContent
    - ... another block i only want to use here
mark-a-j-adriano commented 4 years ago

WORKAROUND: create an elemental that extends ElementalList


/**
 * Elemental class for Numbered List content elements.
 */
class NumberedListElement extends ElementList
{

then in your YML file declare the allowed elements:

PRJ\123\Elemental\NumberedListElement:
  allowed_elements:
    - PRJ\123\Elemental\ContentElement