Default CSS classes for custom block

by manafire   Last Updated October 09, 2019 21:07 PM - source

I've defined a custom block (Drupal 8) and I'm able to specify defaults for block label and my other custom fields but can't figure out how to hook into the 'CSS class(es)' field for defaults that show in the UI to site builders. How would I do so in code? Thanks!

  public function defaultConfiguration() {
    return [
       // works
      'label' => 'My Custom Block Title', 

      // this appears to be the way it's referenced...
      // but doesn't work
      'third_party_settings' => [ 
        'block_class' => [
          'classes' => 'my-custom-class',
        ],
      ],
    ];
Tags : blocks


Related Questions



Create main page content block

Updated April 04, 2015 18:03 PM


Blocks is not showing up

Updated March 29, 2015 06:02 AM