Placeholders
Where is php code editor you can use placeholders.
For row element data in code editor use this format:
{dbCONNECTION_ID__table_name___element_name}
where CONNECTION_ID is a database connection and you can find it from Brixy Lists->Tab Data->Tab Database->Connection ID.
You must use 2 underscores between the CONNECTION_ID and the table name, and you must use 3 underscores between the table and the column.
example: {db3__users___username}.
For joined tables, the returned replacement data will be in json format.
To use it in your php code you can to convert it to array.
Example: You have joined table with 3 rows.
This code will return indexed array with values from field name.
$el_name_joined = '{db2__users___name}';
$el_name_joined_arr = json_decode($el_name_joined, true);
p($el_name_joined_arr, 'el_name_joined_arr');
/*
//Result
el_name_joined_arr : array(
0 => John,
1 => Mark,
2 => Donald,
);
*/
The order will be in the order set by the List settings. If there is none, the records will be arranged in ascending order depending on their creation.
Placeholders to get Logged in user data:
- '{user_id}';
- '{name}';
- '{email}';
- '{user_groups}' - json_encoded array;
- '{lang_id}';
// Logged in User Data:
$user_groups = '{user_groups}';
$user_id = '{user_id}';
$user_name = '{name}';
$email = '{email}';
$lang_id = '{lang_id}';
$debug_user = [
'user_groups' => $user_groups,
'user_id' => $user_id,
'user_name' => $user_name,
'email' => $email,
'$lang_id' => $lang_id,
];
p($debug_user);
Available modes ($view_mode):
- list;
- form;
If you have unexpected results with placeholders to get all data you can use
p($record_data, 'record_data');