Handle type paragraphs

Created on 31 March 2023, over 1 year ago
Updated 4 April 2024, 7 months ago

Hi,
I want to handle a paragraphs field, but get no value in 'public function execute($input)'.

Is it possible to use a paragraphs field and if yes, which setttings are necessary?

🐛 Bug report
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

🇩🇪Germany WalterP

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @WalterP
  • Assigned to eleonel
  • 🇦🇺Australia murrayw

    The field widget only handles the targetting of direct fields on the entity. It may be possible to add the field widget into the Paragraphs form and have it work that way, so it may be possible,

    Assigning this across to Eleo to comment on whether it is possible and what it would take to achieve this.

  • 🇮🇳India naveenvalecha New Delhi

    This is a new feature request instead of a support request.

  • 🇩🇪Germany WalterP

    Thank you for answering.

    I solved the problem with a patch in the AugmentorBaseWidget.

    I add the case for entity_reference_revisions type and pass the entity_id to the service:

    foreach ($source_fields as $field_name) {
          $field_type = $entity->get($field_name)->getFieldDefinition()->getType();
          $nid = $entity->id();
    
          if (!$entity->get($field_name)->isEmpty()) {
            $values = $entity->get($field_name)->getValue();
    
            foreach ($values as $value) {
              switch ($field_type) {
                case 'image':
                case 'entity_reference_revisions':
                  $value = strval($nid);
                  break;

    And in the service I load the entity and get the paragraphs field values and process them.

  • 🇦🇺Australia murrayw

    Thanks for the code WalterP. Eleo passing this over to you to see.

  • Status changed to Postponed: needs info over 1 year ago
  • 🇯🇵Japan eleonel Itoshima 🇯🇵

    Hi Walter, by looking at the code that you provided I can see you are trying to use a paragraph reference field as a source for an augmentor field, and this is something we are trying to avoid, because then how we know from which paragraph fields you want to extract data and merge it for the input

    Instead I recommend to add the augmentor field into the paragraph type and select the source that you want from there. Once you are in the parent entity form, you will be able to execute the augmentor as usual, with the particularity of having the augmentor button inside the paragraph.

  • Status changed to Closed: works as designed over 1 year ago
  • 🇯🇵Japan eleonel Itoshima 🇯🇵
  • 🇺🇸United States keiserjb

    I found this thread because I'm trying to use the module with paragraphs. I could add the augmentor to the paragraph type but there may be more than one of the paragraph type and I would want the augmentor to use the data in all of the body paragraphs not just one of them.

    Looking for ideas.

  • 🇺🇸United States keiserjb

    Putting the Augmentor field inside the paragraph doesn't really work. Say I have a site without body fields. I only have paragraphs. If I put an Augmentor on a body paragraph to create the title of the node I can't target a field outside of the paragraph when configuring it.

Production build 0.71.5 2024