Skip to content

Error on settings page - broken API parameter structure for activity assignee EntityRef field #61

@MarcMichalsky

Description

@MarcMichalsky

This issue may be related to #56.

When opening the Twingle API - Generic Settings page, an error message is displayed:

Screenshot 2023-02-14 at 09-28-15 Twingle API Settings CiviCRM forumZFD

contact_type is an array, but only strings are allowed in $attributes.

Bildschirmfoto vom 2023-02-14 09-07-02

The problem is the twingle_protect_recurring_activity_assignee selection field, which seems to pass an invalid array structure to $this->addEntityRef().

$this->addEntityRef(
'twingle_protect_recurring_activity_assignee',
E::ts('Assigned To'),
[
'contact_type' => ['IN' => ['Individual', 'Organization']],
'check_permissions' => 0,
]
);

According to the documentation, the array passed to $this->addEntityRef() must be structured as follows:

// Use the 'option_value' entity for most "option" lists, e.g. event types, activity types, gender, individual_prefix, custom field options, etc.
$this->addEntityRef('field_5', ts('Activity Type'), [
  'entity' => 'option_value',
  'api' => [
    'params' => ['option_group_id' => 'activity_type'],
  ],
  'select' => ['minimumInputLength' => 0],
]);

If the array is structured correctly, the problem is solved:

Bildschirmfoto vom 2023-02-14 10-31-46

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstatus:fixedThe issue has been resolved (usually by committing/merging code)

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions