It would be great to support several elements to be placed in one column. A possible use case would be building a two column page with several Elements in one column.

The idea would be to create a row bundle and a column bundle. All the other elements would be placed beside or underneath each other depending on the space left.

Comments

bdichgans created an issue. See original summary.

bbuchert’s picture

Assigned: bbuchert » Unassigned
brandonratz’s picture

@bdichgans This would require a fair overhaul of the structure currently present. I do not believe the maintainer had this in mind when developing the paragraph types as they exist currently.

To execute the desired functionality I would do the following:

1. Create a "Card" paragraph type with a paragraph reference field
2. Reference only non-layout (ie no columns) paragraph types (ie accordion, simple, etc)
3. Update the Column paragraph types to only reference "Cards" -- This will cause a card to be selected by default (via latest v. of Paragraphs)

thejimbirch’s picture

I've been thinking about this. @bdichgans and I had been discussing in the Drupal Slack, but I have not had any time to experiment.

Similar to your approach @brandonratz, I suggested that he make a "Column Wrapper" bundle that would reference any other bundle, allowing multiple. That and a custom template for it would probably work.

I am thinking this should be included in the module, but adding it is going to be another challenge. Currently the module hits the config files on install and never again. I would need to learn how to write an update hook to install a new bundle and it's fields. It's something that is on my list of things to learn, but not sure how quick I can.

thejimbirch’s picture

Title: Support several items in one cloumn. » Support several items in one column
bbuchert’s picture

So you are planning to provide an upgrade path?

brandonratz’s picture

I will not speak for Jim on this issue but I'll share my thoughts on upgrade path.

The least abrasive path would be simply to add the "container" and not force the end user into any opinionated structure. An upgrade path would naturally exist because the "container" would be an optional paragraph type.

thejimbirch’s picture

Here is the start of my attempting to add a new bundle called "Column wrapper". Column wrapper will allow you to reference multiple paragraphs from within a column.

Trying to follow the suggestion here:

https://drupal.stackexchange.com/a/164969/13347

Using the following in the bootstrap_paragraphs.install file

/**
 * Adds Column Wrapper paragraphs bundle.
 */
function bootstrap_paragraphs_update_8201() {

  use Drupal\Core\Config\FileStorage;

  /* where $path is the absolute path to the my_config.foo.yml file */
  $path = '/config/install/paragraphs.paragraphs_type.bp_column_wrapper.yml';
  $source = new FileStorage($path);
  /** @var \Drupal\Core\Config\StorageInterface $active_storage */
  $active_storage = \Drupal::service('config.storage');
  $active_storage->write($name, $source->read($name));
}

But it's not working yet.

1) I haven't got my local to notice there is an update yet.
2) If I do, I need to write this to have all 5 of the new config files.

Working branch is on Github at https://github.com/xenomedia/bootstrap_paragraphs/tree/2877261-column-wr...

  • thejimbirch committed 0d2a7b5 on 8.x-2.x
    git commit -m 'Issue #2877261 by albertski: Support several items in one...
  • thejimbirch committed a71e5d6 on 8.x-2.x
    Issue #2877261 by albertski: Support several items in one column
    
thejimbirch’s picture

This has been committed to dev. After running the database update, a new Paragraphs bundle called Column Wrapper will be installed.

The Column Wrapper bundle allows you to add multiple Paragraphs in a single Column Content field.

If you would like to use this bundle, allow it to be selected in the Column Content field of the three Columns Paragraphs bundles. It is not added automatically.

@TODO Add to those fields in the initial config.

thejimbirch’s picture

Version: 8.x-2.0-alpha3 » 8.x-2.x-dev

  • thejimbirch committed 5f449ba on 8.x-2.x
    Issue #2877261 by thejimbirch: Adds Column Wrapper bundle to the 3...

  • thejimbirch committed 67ec10f on 8.x-2.x
    Issue #2877261 by thejimbirch: Updates the Column Wrapper Content field...
thejimbirch’s picture

Status: Active » Fixed
thejimbirch’s picture

Status: Fixed » Closed (fixed)

Closed in 8.x-2.0-alpha5. Thanks all!

bbuchert’s picture

Great! I think an example could be helpful.