Invalid arguments passed in Drupal\business_rules\Form\BusinessRuleForm->form() (line 143

Created on 20 April 2021, over 3 years ago
Updated 19 January 2024, 10 months ago

Problem/Motivation

When creating a new rule, this error is present in the log: Invalid arguments passed in Drupal\business_rules\Form\BusinessRuleForm->form() (line 143

Steps to reproduce

Create new rule, click on save and go to log messages to see the error.

Proposed resolution

This solves the problem
https://www.drupal.org/project/business_rules/issues/2998984#comment-131...

In modules/contrib/business_rules/src/Form/BusinessRuleForm.php Line 140 :

$form['tags'] = [
        '#type'                          => 'textfield',
        '#title'                         => $this->t('Tags'),
//        '#default_value'                 => implode(', ', $business_rule->getTags()),
	'#default_value'                 => (is_array($business_rule->getTags()) && count($business_rule->getTags())) ? implode(', ', $business_rule->getTags()) : '',
        '#description'                   => $this->t('List of comma-separated tags.'),
        '#required'                      => FALSE,
        '#autocomplete_route_name'       => 'business_rules.autocomplete_tags',
        '#autocomplete_route_parameters' => [],

      ];

And /modules/contrib/business_rules/src/Form/ItemForm.php Line 150 :

$form['tags'] = [
        '#type'                          => 'textfield',
        '#title'                         => $this->t('Tags'),
//        '#default_value'                 => $item->getTags() ? implode(', ', $item->getTags()) : '',
	'#default_value'                 => (is_array($item->getTags()) && count($item->getTags())) ? implode(', ', $item->getTags()) : '',
        '#description'                   => $this->t('List of comma-separated tags.'),
        '#required'                      => FALSE,
        '#weight'                        => 41,
        '#autocomplete_route_name'       => 'business_rules.autocomplete_tags',
        '#autocomplete_route_parameters' => [],

      ];
🐛 Bug report
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

🇮🇹Italy kris77

Live updates comments and jobs are added and updated live.
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.

Production build 0.71.5 2024