Cannot edit task after creation

Created on 29 November 2024, about 1 month ago

Problem/Motivation

I have just upgraded to version 1.0.46 and performed a complete re-install. When I try to edit a task that I have created, it gives me the following error. Any suggestion how this error can be tracked down?

The website encountered an unexpected error. Try again later.
TypeError: array_merge(): Argument #1 must be of type array, string given in array_merge() (line 137 of core/lib/Drupal/Core/Render/Element/RenderElementBase.php).
Drupal\Core\Render\Element\RenderElementBase::setAttributes() (Line: 391)
template_preprocess_textarea()
call_user_func_array() (Line: 261)

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇦🇺Australia purencool

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

Comments & Activities

  • Issue created by @purencool
  • 🇨🇦Canada jeremylichtman

    I think that must be the custom attributes I tried adding to the textareas.

    Since they're not actually needed, I have removed them.

    Tag 1.0.47 added.

    Hope that fixes it for you.

  • 🇦🇺Australia purencool

    Before upgrading, I tried adding an extra code to your commit locally. It was in the hope it would give form elements to give greater flexibility and less fragility when working with JQuery, It appears that the Drupal API needs an array and not a string in this case. Let me know what you think.

       $form['log']['comment'] = [
            '#type' => 'container',
            '#title' => $this->t('Add a comment'),
            '#attributes' => [
              'class' => ['add_comment'], <---- Turned your strings into arrays
            ],
          ];
          $form['log']['comment']['body'] = [
            '#type' => 'textarea',
    		    '#attributes' => [
              'class' => ['add_comment_text'],
            ],
          ];
          $form['log']['comment']['link'] = [
            '#markup' => $this->t('<a href="#" class="button">%label</a>', [
              '%label' => 'Add Comment',
            ]),
          ];
    
          // Work log form.
          $form['log']['work'] = [
            '#type' => 'container',
            '#title' => $this->t('Add a work log'),
            '#attributes' => [
              'class' => ['add_work'],
            ],
          ];
          $form['log']['work']['body'] = [
            '#type' => 'textarea',
            '#title' => $this->t('Comment'),
    		    '#attributes' => [
              'class' => ['add_work_text'],
            ],
          ];
    

  • 🇨🇦Canada jeremylichtman

    I've pushed this on the dev branch. We don't need those classes immediately, but you're right that it may be more robust in the future.

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

Production build 0.71.5 2024