syntro-opensource/silverstripe-elemental-bootstrap-accordionsection

Can't add custom bootstrap element

Closed this issue · 1 comments

mo311 commented

My custom element won't show in admin area.

Code:

`<?php

namespace Syntro\SilverstripeElementalBootstrap\Elements;

use SilverStripe\Forms\FieldList;
use Syntro\SilverstripeElementalBootstrap\Controllers\BootstrapElementController;

/**

  • A custom bootstrap element.
    */
    class BootstrapMyElement extends BootstrapElement
    {

    private static $table_name = 'Syntro_Custom_Elemental_BootstrapMyElement';

    private static $title = 'My Element';

    private static $singular_name = 'My Element';

    private static $plural_name = 'My Elements';

    private static $description = 'A custom bootstrap Element.';

    /**

    • @var string
      */
      private static $controller_class = BootstrapElementController::class;

    /**

    • getCMSFields - get fieldlist for CMS

    • @return FieldList
      */
      public function getCMSFields()
      {
      $fields = parent::getCMSFields();

      // ...

      return $fields;
      }

    /**

    • getType - get the translated name
    • @return string
      */
      public function getType()
      {
      return _t(CLASS . '.BlockType', 'My Element');
      }

}
`

mo311 commented

have forgot to add it to allowed_elements in config