Problem/Motivation

Some plugins - such as Border - have lots of options, and the developer might want to disable any of them.

For example, my design specs could say that there are no border-radius at all, so I won't need all the border-radius options.

I emptied the classes:

Empty classes on rounded corner options

... but the UI still apears, which might be confusing to the user:

Ui for rounded corners

Proposed resolution

I think a nice feature could be to check for the absence of any defined style options and, if so, hide the UI

Something like this just works:

    if ($this->getStyleOptionsCount('rounded_corners') > 0) {
      $form['rounded_corners'] = [
        '#type' => 'range',
        '#title' => '<span class="sr-only">' . $this->t('Corners') . '</span><div class="bs_tooltip" data-placement="top" role="tooltip">' . $this->t('All Corners') . '</div>',
        '#min' => 0,
        '#max' => $this->getStyleOptionsCount('rounded_corners'),
        '#step' => 1,
        '#default_value' => $default_value,
        '#validated' => TRUE,
        '#attributes' => [
          'class' => ['bs-field-rounded-corners'],
        ],
        '#description' => $this->getSvgIconMarkup($icon_path . 'plugins/border/border-radius.svg'),
      ];
    }

Comments

idiaz.roncero created an issue.