Skip to content
Snippets Groups Projects

Issue #1899236: Add new Splitbutton render element to eventually replace Dropbutton

Closed Issue #1899236: Add new Splitbutton render element to eventually replace Dropbutton
6 unresolved threads
Closed Ben Mullins requested to merge issue/drupal-1899236:1899236-add-new-splitbutton into 9.3.x
6 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1 <?php
2
3 namespace Drupal\Core\Render\Element;
4
5 use Drupal\Component\Utility\Html;
6 use Drupal\Core\StringTranslation\StringTranslationTrait;
7
8 /**
9 * Provides a button that toggles the visibility of list of actions.
  • 20 * dropbutton variant for styling purposes. This is used in some themes to add
    21 * the class `splitbutton--#splitbutton_type` to the splitbutton wrapper and
    22 * `button--#splitbutton_type` to the main and toggle buttons.
    23 * - #title: This changes the default splitbutton behavior of displaying a
    24 * primary splitbutton item next a separate toggle button. When this property
    25 * is present, there is no primary item, just a toggle.
    26 * - #exclude_toggle: Defaults to FALSE. Largely used by render elements
    27 * extending splitbutton. When TRUE, no toggle button is added even if the
    28 * configuration would typically result in its addition. For these uses, it
    29 * should be confirmed that there is still an element with the
    30 * `data-drupal-splitbutton-trigger` attribute, as it is necessary for
    31 * splitbutton's JavaScript.
    32 * - #hover: If this is TRUE and #title is not empty or false, the splitbutton
    33 * can be opened on hover.
    34 *
    35 * Deprecated Properties:
  • 82 '#attached' => [
    83 'library' => 'core/drupal.splitbutton',
    84 ],
    85 ];
    86 }
    87
    88 /**
    89 * Pre-render callback. Builds Splitbutton render array.
    90 *
    91 * @param array $element
    92 * The render element.
    93 *
    94 * @return array
    95 * Render array.
    96 */
    97 public static function preRenderSplitbutton(array $element) {
  • 214 }
    215 break;
    216
    217 case this.keyCode.DOWN:
    218 if (this.splitbutton.hasAttribute(`${this.dataPrefix}open`)) {
    219 this.focusNext(e);
    220 } else {
    221 this.open();
    222 this.focusFirst();
    223 }
    224 break;
    225
    226 // case this.keyCode.TAB:
    227 // this.focusTrigger();
    228 // this.close(true);
    229 // break;
  • 161 $this->assertNull($splitbutton->find('css', '[data-drupal-splitbutton-item-list]'));
    162 }
    163 }
    164
    165 /**
    166 * Data provider for testSplitbuttons().
    167 *
    168 * @return string[][]
    169 * An array of themes to install for the test.
    170 */
    171 public function providerTestSplitbuttons() {
    172 return [
    173 'stark' => [''],
    174 'claro' => ['claro'],
    175 'seven' => ['seven'],
    176 'bartik' => ['bartik'],
  • 71 71 - seven/filter
    72 72 filter/drupal.filter:
    73 73 - seven/filter
    74 media/media_embed_ckeditor_theme:
    75 - seven/classy.media_embed_ckeditor_theme
    74 core/drupal.splitbutton:
    75 - seven/splitbutton
  • Please register or sign in to reply
    Loading