After recently updating a “hub” to Omeka 4.1.1, I had 2 out of 4 sites on it it crash. The 2 that didn’t crash didn’t have anything but some CSS and a logo or two. The 2 that did crash had the same error message that didn’t show on the Admin Log, but did show on the error_log that I found in the CPanel File Manager:
[24-Feb-2025 05:35:11 UTC] PHP Warning: Undefined variable $html in /home/haitians/andrewwyattmaginn.org/Digital_Humanities/modules/BlockPlus/view/common/block-layout/html.phtml on line 15
After deactivating the BlockPlus module, the sites work again, but how can I fix it?
The revised HTML block in the BlockPlus module has been discontinued, with the HTML block reverting to the core Omeka code.
I imagine the two sites that are not working use a custom theme? If so, you will need to revise your theme, updating the $html variables in your custom HTML block with $block->dataValue(‘html’, ‘’)
As a stopgap- presuming your HTML blocks/templates aren’t doing anything special- you could update each HTML block to display the ‘Block Plus: Page header’ template (see screenshot). This can be done from within Omeka, without revising the theme.
Actually, the theme customization on these sites was just done through the CSS Editor only–I hadn’t started fiddling in the actual theme yet.
I was able to band-aid it for now by just deactivating BlocksPlus, but will readdress it in a few days.
In case you are curious, other than using HTML blocks as literal text boxes, both sites have a page with an HTML block that called a list of items determined by a [shortcode]plus a <script> tag that added two buttons for each item:
<div class="preview-block clearfix">[items item_set=67 num=0 sort=foaf:lastName]</div>
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', async () => {
const items = document.querySelectorAll('.resource.item');
for (let item of items) {
const itemThumb = item.querySelector('.resource.item a').firstChild;
itemThumb.classList.add('item-thumbnail');
// Create 'item-buttons' container if not present
let itemButtons = item.querySelector('.item-buttons');
if (!itemButtons) {
itemButtons = document.createElement('div');
itemButtons.classList.add('item-buttons');
item.appendChild(itemButtons);
}
// Extract the item ID from the title link
const idMatch = item.querySelector('h4 a').getAttribute('href').match(/\/item\/(\d+)/);
if (idMatch) {
const itemID = idMatch[1];
// Create and append "Learn More" button
const buttonLearn = document.createElement('a');
buttonLearn.setAttribute('href', '/Digital_Humanities/s/mapping-migration/item/' + itemID);
buttonLearn.classList.add('button-learn');
buttonLearn.innerHTML = '<img src="https://www.andrewwyattmaginn.org/Digital_Humanities/files/asset/b48d328fdce980ace20b326deea5b7f1f83a42d5.png" alt="Button Learn More">';
itemButtons.appendChild(buttonLearn);
// Create and append "Sources" button
const buttonSource= document.createElement('a');
buttonSource.setAttribute('href', '/Digital_Humanities/s/mapping-migration/page/Map-' + itemID);
buttonSource.classList.add('button-source');
buttonSource.innerHTML = '<img src="https://www.andrewwyattmaginn.org/Digital_Humanities/files/asset/be5f1634e4ed2c40fcfd44491bdb567bdeb84da3.png" alt="Button for Map">';
itemButtons.appendChild(buttonSource);
}
}
});
</script>