Skip to content
Snippets Groups Projects
Verified Commit c2afd01d authored by Rob Loach's avatar Rob Loach
Browse files

Issue #3338072 by pcambra: TypeError: array_filter(): Argument #1 () must be...

Issue #3338072 by pcambra: TypeError: array_filter(): Argument #1 () must be of type array, null given in array_filter()
parent 3bdb3b86
No related branches found
No related tags found
No related merge requests found
transaction_roles:
anonymous: "0"
authenticated: "0"
administrator: "0"
user_data:
id: "0"
roles: "0"
newrelic_transactions.config:
type: config_object
label: 'NewRelic Transactions config'
mapping:
transaction_roles:
type: sequence
label: 'Setting to limit roles'
sequence:
type: string
label: 'Role'
user_data:
type: sequence
label: 'Setting to slow transaction data'
sequence:
type: string
label: 'User data'
......@@ -80,7 +80,7 @@ class EventSubscriber implements EventSubscriberInterface {
}
// Get the roles that have been explicitly enabled for transaction naming.
$enabled_roles = $config->get('transaction_roles');
$enabled_roles = $config->get('transaction_roles') ?? [];
$enabled_roles = array_filter($enabled_roles);
// If no roles have been enabled, all system roles will be used.
......@@ -120,7 +120,7 @@ class EventSubscriber implements EventSubscriberInterface {
$config = $this->configFactory->get('newrelic_transactions.config');
// Get user_data config.
$user_data = $config->get('user_data');
$user_data = $config->get('user_data') ?? [];
// Track some data about the current user
// so we can identify who is having trouble.
......
......@@ -91,17 +91,17 @@ class NewRelicTransactionsConfig extends ConfigFormBase {
];
// Roles to pass to transactions.
$default = $config->get('transaction_roles');
$default = $config->get('transaction_roles') ?? [];
$form['transaction_roles'] = [
'#type' => 'checkboxes',
'#title' => $this->t('Limit Roles'),
'#default_value' => $default ?? [],
'#default_value' => $default,
'#options' => $role_options,
'#description' => $this->t('Leave blank for all roles. Transactions will be tagged with the user\'s highest weight role (lowest in this list). Go to <a href="/admin/people/roles">Roles</a> to reorder.'),
];
// User data to pass as custom parameter.
$default = $config->get('user_data');
$default = $config->get('user_data') ?? [];
$role_keys = array_keys($data_options);
$form['user_data'] = [
'#type' => 'checkboxes',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment