Search code examples
javascriptconcrete5

How can I delete a block that contains faulty JavaScript breaking the C5 interface?


I was working on an HTML block in Concrete5 located in the footer. I made a javascript call - can't quite remember it, but I think it was referencing either jQuery or the Google Maps API. Anyway, now the block won't display and oddly enough, I am completely unable to modify/add/remove blocks now. I'm pretty sure it is because of the javascript call it is making, but I can't modify or delete the block to fix the issue.

What am I supposed to now? I tried disabling javascript in my browser but of course that won't let me modify the blocks either.


Solution

  • I don't know 5.8+ that well yet, but this may be unfixable from within the UI.

    If the error is in a global area, your best bet might be opening the template, changing the area name where the global area is used and displayed, and recreating it from scratch.

    You'd be looking for something like this:

    $a = new GlobalArea("Footer Nav");
    

    and change the global area's name, thus creating a new one.

    If that's not an option, you may have to resort to deleting (or altering) the faulty block through the API.

    In my experience, the easiest way to get a blank page that has C5 bootstrapped is creating a custom Dashboard page:

    It's a common task for a Concrete5 developer to create their own Dashboard pages. Dashboard pages are just single pages located inside the "single_pages/dashboard" directory. Once they're added within that location, they automatically show up in the Dashboard.

    Now, as to how to edit or delete the block inside the area, I don't have a complete recipe, but this example page showing advanced area operations should get you started.

    The API documentation for GlobalAreas is here, for Block here (notice the delete() / deleteBlock() methods.)