Sort paragraph names alphabetically in node add/edit form

Created on 20 July 2016, over 8 years ago
Updated 20 August 2024, 4 months ago

Is it possible to sort paragraph adding list alphabetically based on Paragraph name (not machine name if thats what is currently used)?

See the attached image, for what is happening currently.

I expected the following order on the dropdown:

  • 1 Column
  • 2 Column
  • 3 Column
  • Accordion
  • Block
  • Call to action
  • Customer Testimonial
  • Featured Content
  • Header Image
  • Image Left Text Right
  • Image Right Text Left
πŸ’¬ Support request
Status

Fixed

Version

1.0

Component

User interface

Created by

πŸ‡¦πŸ‡ΊAustralia realityloop

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States webdrips

    For me, the dropdown list wasn't even sorting by the weights set, and I had to set my custom module weight to 12 (one higher than paragraphs) to get the following code working:

    ...
    switch ($form_id) {
      case 'blah':
        $field = 'field_blah';
        break;
    ...
    }
    
    if (isset($form[$field]['widget']['add_more']['add_more_select']['#options'])) {
      natsort($form[$field]['widget']['add_more']['add_more_select']['#options']);
    }
    ...
    
  • I want to fix the same issue.
    Why is this issue marked as "fixed" ?
    There is no patch.

  • πŸ‡¨πŸ‡¦Canada JayDarnell Guelph, Ontario

    This issue needs to be reopened.

  • who is closing unresolved issues, especially lying by marking it as "fixed" ?

  • First commit to issue fork.
  • You can also find your field config for the paragraph field and manually sort the paragraph names in the field target_bundles setting.

    settings:
      handler: 'default:paragraph'
      handler_settings:
        target_bundles:
          accordion_section: accordion_section
          anchor: anchor
          article_listing: article_listing
          background_section_break: background_section_break
          buttons: buttons
          card_gallery: card_gallery
          card_grid: card_grid
          collection: collection
Production build 0.71.5 2024