Postponed on #3083256: Create smaller variations for form elements

Problem/Motivation

Claro automatically sets operations dropbuttons to '#type' => 'extrasmall'. If the operations dropbutton is accompanied by other form elements, those form elements will still be at their default size, and the form elements will not have inconsistent sizes.

When #3083256: Create smaller variations for form elements is added to core, the form--small and form--extrasmall classes will be made available. Wrapping a form in these classes will results in all form elements taking on their small/extrasmall variants, and eliminate the issue of inconsistent sizes.

Steps to reproduce

>

Proposed resolution

Find the best way to wrap forms with operations dropbuttons in form--extrasmall.
If the method used is comprehensive enough, also remove the prerender enforcing the extrasmall variant for operations dropbuttons,

in ClaroPreRender

/**
   * Prerender callback for the Operations element.
   */
  public static function operations($element) {
    if (empty($element['#dropbutton_type'])) {
      $element['#dropbutton_type'] = 'extrasmall';
    }
    return $element;
  }

In claro.theme

// Add a pre-render function for Operations to set #dropbutton_type.
  if (isset($type['operations'])) {
    // In Claro, Operations should always use the extrasmall dropbutton variant.
    // To add CSS classes based on variants, the element must have the
    // #dropbutton_type property before it is processed by
    // \Drupal\Core\Render\Element\Dropbutton::preRenderDropbutton(). This
    // ensures #dropbutton_type is available to preRenderDropbutton().
    $operations_pre_renders = !empty($type['operations']['#pre_render']) ? $type['operations']['#pre_render'] : [];
    array_unshift($operations_pre_renders, [ClaroPreRender::class, 'operations']);

    $type['operations']['#pre_render'] = $operations_pre_renders;
  }

Remaining tasks

After implementing, address any @todo items referencing this issue.

User interface changes

API changes

Data model changes

Release notes snippet

Comments

bnjmnm created an issue. See original summary.

bnjmnm’s picture

bnjmnm’s picture

Status: Active » Postponed

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.