Trying to use this on craft 5 (Craft 5.6.4, MariaDB, PHP 8.2), whenever I drill down to the field usage, I'm getting a null variable error.
e.g.
Twig Runtime Error – Twig\Error\RuntimeError
Impossible to access an attribute ("name") on a null variable.
-
in /var/www/html/bso/vendor/simplygoodwork/craft-block-usage/src/templates/entries.twigat line 87
78798081828384858687888990919293949596
{% for entry in blockEntries.entries %}
<tr>
<td>{{ entry.id }}</td>
<td>
<a href="{{ entry.cpEditUrl() }}">{{ entry.title }}</a>
</td>
<td>
{{ entry.section.name }}
</td>
<td>
{{ entry.type.name }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
OR
Error
Call to a member function getOwner() on null
-
in /var/www/html/bso/vendor/simplygoodwork/craft-block-usage/src/services/BlockUsageService.phpat line 113
104105106107108109110111112113114115116117118119120121122 elseif ($field->displayName() == 'Matrix') {
foreach($field->getEntryTypes() as $entryType)
{
$entries = Entry::find()->typeId($entryType->id)->status(null)->collect();
$topLevelEntries = $entries->map(function($entry){
try {
$owner = $entry->getOwner();
while($owner->getOwner()) {
$owner = $owner->getOwner();
}
return $owner;
} catch(Exception $e) {
return $entry;
}
})->unique();
Trying to use this on craft 5 (Craft 5.6.4, MariaDB, PHP 8.2), whenever I drill down to the field usage, I'm getting a null variable error.
e.g.
Twig Runtime Error – Twig\Error\RuntimeError
Impossible to access an attribute ("name") on a null variable.
in /var/www/html/bso/vendor/simplygoodwork/craft-block-usage/src/templates/entries.twigat line 87
78798081828384858687888990919293949596
{% for entry in blockEntries.entries %}
OR
Error
Call to a member function getOwner() on null
in /var/www/html/bso/vendor/simplygoodwork/craft-block-usage/src/services/BlockUsageService.phpat line 113
104105106107108109110111112113114115116117118119120121122 elseif ($field->displayName() == 'Matrix') {