Hi,
I ran into a problem when embedding a SEBLOD List & Search inside a Content Form on Joomla 5.
The same SEBLOD List & Search works correctly when opened directly through a menu item/page. However, when I embed it inside a Content Form using a SEBLOD List field, the list initially returns no visible results.
After tracing the SEBLOD PHP execution path, I found two separate issues.
Environment / scenario
- Joomla 5
- SEBLOD 3.x
- A List & Search embedded in a Content Form using the SEBLOD
cck_list field - The search should restrict the results to a specific SEBLOD content type
The embedded list follows this path:
plugins/cck_field/cck_list/cck_list.php
→ _render()
→ libraries/cck/base/list/list_inc.php
→ CCK_List::getList()
→ Joomla onContentSearch
→ plugins/search/cck/cck.php
→ list rendering
Issue 1: the CCK search value gets lost
The cck search field has a configured live_value containing the required SEBLOD content type and uses an exact match.
But inside the embedded list, $lives['cck'] exists with an empty value.
In list_inc.php, the presence of this empty live value takes precedence over the field's configured live_value.
As a result, after onCCK_FieldPrepareSearch, I had essentially:
$field->value = ""
$field->live_value = "<configured content type>"
The generated SQL therefore did not contain a CCK restriction. Instead of only the expected matching records, SEBLOD selected all Joomla article-based SEBLOD records — more than 21,000 records in my case.
For testing, I added this directly after onCCK_FieldPrepareSearch in:
libraries/cck/base/list/list_inc.php
if (
$field->name == 'cck'
&& $field->value === ''
&& $field->live_value !== ''
) {
$field->value = $field->live_value;
}
After this change, the generated SQL correctly contained a restriction on t0.cck, and the query returned only the expected records.
Issue 2: CCK_List::getList() assumes the SEBLOD search result is $data[0]
There was another problem in:
libraries/cck/base/list/list.php
CCK_List::getList() calls:
$data = $app->triggerEvent(
'onContentSearch',
array(
'',
'',
$ordering,
$areas['active'],
$fields,
$fields_order,
$config,
$current,
$options,
$user
)
);
The original SEBLOD code then assumes:
if (isset($data[0])) {
$config = $data[0]['config'];
$list = $data[0]['results'];
} else {
$list = array();
}
On my Joomla 5 installation, however, triggerEvent() returned five plugin results:
$data[0] = []
$data[1] = []
$data[2] = []
$data[3] = []
$data[4] = [
'config' => ...,
'query' => ...,
'results' => [...]
]
The SEBLOD onContentSearch() plugin itself was working correctly. Immediately before return $data; in plugins/search/cck/cck.php, I confirmed that results contained the expected records.
The problem was simply that the SEBLOD result was at index 4, not index 0.
I replaced the original code with:
$list = array();
foreach ((array) $data as $result) {
if (
is_array($result)
&& array_key_exists('config', $result)
&& array_key_exists('results', $result)
) {
$config = $result['config'];
$list = $result['results'];
break;
}
}
After this change, CCK_List::getList() correctly returned the expected results.
Memory error was a consequence, not the root cause
During debugging I also got:
Allowed memory size of 268435456 bytes exhausted
in:
libraries/cck/base/list/list_inc_list_items.php
around:
$item->positions_m = $positions_p;
Initially this looked like a rendering or $positions_p problem.
It was not.
Without the CCK restriction, SEBLOD was trying to render 21,825 records. With the CCK value restored, only the expected records were passed to list_inc_list_items.php, and memory usage remained normal.
For comparison:
without CCK filter:
items: 21825
memory before rendering: ~28 MB
memory during first item: ~174 MB
→ eventually 256 MB exhausted
with CCK filter:
items: 6
memory before rendering: ~14 MB
memory during first item: ~14 MB
→ no memory error
Result
With both changes in place:
- the embedded List & Search receives the correct CCK filter;
- SQL returns the expected records;
CCK_List::getList() receives the correct Joomla search-plugin result;- the memory error disappears;
- and the list is displayed correctly inside the Content Form.
These are currently local core modifications, so obviously they may be overwritten by a SEBLOD update.
The second issue in particular looks like a Joomla 5 compatibility problem: CCK_List::getList() assumes that the relevant onContentSearch result is always $data[0], but Joomla can return results from multiple search plugins and the SEBLOD result is not necessarily the first entry.
For the first issue, I am not yet sure whether restoring live_value in list_inc.php is the correct general solution or whether the empty value should be prevented earlier in the embedded cck_list field processing.
Has anyone else seen these two issues with embedded SEBLOD lists on Joomla 5?
I would also be interested to know what the preferred upstream fix would be, especially for the triggerEvent() result handling.