Problem/Motivation

Currently we have two options for the Accordion / Tabs Paragraphs bundle:

  1. Accordion
  2. Tabs (become Accordion on small devices)

In some cases it makes sense to have tabs also on small devices.

Steps to reproduce

Proposed resolution

Add "Tabs" as third option.

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

thomas.frobieter created an issue. See original summary.

anybody’s picture

+1 good idea

anybody’s picture

@Grevil can do the code review.

grevil’s picture

Component: Code » drowl_paragraphs_types

This is a submodule issue!

grevil’s picture

Title: Type: Accordion / Tabs - allow tabs also on small devices » [drowl_paragraphs_types] Type: Accordion / Tabs - allow tabs also on small devices
grevil’s picture

Value should be called:

tabs_only|Tabs (on all devices)
anybody’s picture

@Grevil: Here's the boilerplate code for the update hook in the submodule:
https://drupal.stackexchange.com/a/307268/47035

Something like this:

$config = Drupal::entityTypeManager()->getStorage('field_storage_config')->load('paragraph.field_paragraphs_tabs_acc_type');
$allowed_values = $config->getSetting('allowed_values');
// Add new value "tabs_only|Tabs (on all devices)":
$allowed_values[] = [
  'value' => 'tabs_only',
  'label' => 'Tabs (on all devices)',
];
$config->setSetting('allowed_values', $allowed_values)->save();

And don't forget the save() xD

This is how it looks like in the yml:

settings:
  allowed_values:
    -
      value: accordion
      label: Accordion
    -
      value: tabs
      label: 'Tabs (wird auf kleinen Geräten zum Accordion)'
  allowed_values_function: ''

Please add a snippet for us and at https://www.drupal.org/docs/drupal-apis/update-api/updating-entities-and...

thomas.frobieter’s picture

Component: drowl_paragraphs_types » Code
thomas.frobieter’s picture

Component: Code » drowl_paragraphs_types

grevil’s picture

On an unrelated note, there are 66 occurences of "accordion" inside "config/install" and 55 occurences of "accordeon"...

Maybe we mixed that up at one point with the German word "Akkordeon"? But "Accordion" is the correct english name

anybody’s picture

@Grevil thanks, Accordion is correct in English! Should be corrected, where it is just a string. If functionality is affected, it should please not be changed. Not worth the trouble.

And please create a small separate issue for that.

grevil’s picture

Any other "field.field.paragraph.container_tabs_accordion.[...].ymls which need this entry? Or only "field_paragraphs_tabs_acc_type"?

See:
screenshot

grevil’s picture

Furthermore I am really confused with the description of this issue:

Add "Tabs" as third option

Currently we have two options for the Accordion / Tabs Paragraphs bundle:

Accordion
Tabs (become Accordion on small devices)

So we want 3 Options? What is the third one, if there are already 2? And where are these two options set? Not in "field.field.paragraph.container_tabs_accordion.field_paragraphs_tabs_acc_type.yml". And why does the example of @Anybody adds two options?

grevil’s picture

OK, I hope the MR is what you expect! I'll have to test it locally first.

anybody’s picture

@Grevil: Commented. Looking good, hope it works :)

For testing you have to ensure you're installing the module before applying this patch of course.

grevil’s picture

Status: Active » Needs review

Please review

anybody’s picture

Assigned: thomas.frobieter » grevil
Status: Needs review » Reviewed & tested by the community

RTBC after fixing the last comment.

Please create a new 4.2.20 release afterwards. Be careful with the branches.

  • Grevil committed 7efabd31 on 4.x authored by Anybody
    Issue #3328592: [drowl_paragraphs_types] Type: Accordion / Tabs - allow...
grevil’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.