The code block from Drupal\ds\Form\ClassesForm seems to unessarily prevent the use of custom CSS classes for fields if the ds_extras module is not enabled:

    // Only show field classes if DS extras module is enabled.
    if (\Drupal::moduleHandler()->moduleExists('ds_extras')) {
      $form['fields'] = [
        '#type' => 'textarea',
        '#title' => $this->t('CSS classes for fields'),
        '#default_value' => implode("\n", $config->get('classes.field')),
        '#description' => $this->t('Configure CSS classes which you can add to fields on the "manage display" screens. Add multiple CSS classes line by line.<br />If you want to have a friendly name, separate class and friendly name by |, but this is not required. eg:<br /><em>class_name_1<br />class_name_2|Friendly name<br />class_name_3</em>'),
      ];
    }

Since Field Templates is part of Display Suite core (and even mentions adding classes in its enable form), why is this feature disabled if ds_extras is not enabled? I tested with the restriction removed and the feature worked as expected without ds_extras. Is there something I am missing and somewhere things will explode if this feature is used without ds_extras or is it some old code hold over when maybe the Field Templates feature may have been intended to go into the Extras module? If the later it would be useful if the restriction was removed.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

magicmyth created an issue. See original summary.

magicmyth’s picture

Attaching a patch to always enable "CSS classes for fields" form field.

swentel’s picture

Status: Active » Needs review

Hmm, you're right, this doesn't make any sense at all, let's see what the bot thinks.

  • swentel committed a3b4690 on 8.x-3.x authored by magicmyth
    Issue #2893219 by magicmyth: Don't require ds_extras for CSS classes for...
swentel’s picture

Status: Needs review » Fixed

commited and pushed, thanks!

swentel’s picture

Status: Fixed » Closed (fixed)