Replies: 1 comment 1 reply
-
There is a new overriding option in JCB that allows you to override any admin view layout. There is no documentation for this yet... Here is the basic introduction to this idea: https://www.youtube.com/watch?v=2KFuRRHQNpg To get this to work, you must create a layout in JCB. <?php if ($displayData->state->get('filter.published') == -2 && ($displayData->canState && $displayData->canDelete)) : ?>
<script>
// change the class of the delete button
jQuery("#toolbar-delete button").toggleClass("btn-danger");
// function to empty the trash
function emptyTrash() {
if (document.adminForm.boxchecked.value == 0) {
// select all the items visable
document.adminForm.elements['checkall-toggle'].checked=1;
Joomla.checkAll(document.adminForm.elements['checkall-toggle']);
// check to confirm the deletion
if(confirm('<?= JText::_("Are you sure you want to delete? Confirming will permanently delete the selected item(s)!") ?>')) {
Joomla.submitbutton('<?= $displayData->get("name") ?>.delete');
} else {
document.adminForm.elements['checkall-toggle'].checked=0;
Joomla.checkAll(document.adminForm.elements['checkall-toggle']);
}
} else {
// confirm deletion of those selected
if (confirm('<?= JText::_("Are you sure you want to delete? Confirming will permanently delete the selected item(s)!") ?>')) {
Joomla.submitbutton('<?= $displayData->get("name") ?>.delete');
};
}
return false;
}
// function to exit the tash state
function exitTrash() {
document.adminForm.filter_published.selectedIndex = 0;
document.adminForm.submit();
return false;
}
</script>
<div class="alert alert-error">
<h4 class="alert-heading">
<span class="icon-trash"></span>
<?= JText::_("Trashed items") ?>
</h4>
<p><?= JText::_("You are currently viewing the trashed items.") ?></p>
<button onclick="emptyTrash();" class="btn btn-small btn-danger">
<span class="icon-delete" aria-hidden="true"></span>
<?= JText::_("Empty trash") ?>
</button>
<button onclick="exitTrash();" class="btn btn-small">
<span class="icon-back" aria-hidden="true"></span>
<?= JText::_("Exit trash") ?>
</button>
</div>
<?php endif; ?> You can of course change the layout code, but what needs to be absolutely the same is the layout name, more importantly is name in code must be "trashhelper" Here is the deal.. you can in the normal layouts simple by means of a naming convention override any admin view layout. All you need to do is know how broad or narrow you want your override to work. Since the override can effect all your components, or all your just some views, or just some component and view. Okay so the convention does not care about underscores or spaces... you basically have the following codename in your layout:
TO get a layout name... open the admin layouts area of your component as this will give you the view name and layout name to use if you just want to override one layout in one view. This is kinda crazy.... since you can create a layout with the codename With the following code:
And doing so override all views layout of Just realize with great power comes great responsibility... 👍 |
Beta Was this translation helpful? Give feedback.
-
I need to make changes to a pretty complex admin view (which will also be used on the front-end) with multiple tabs.
Normally I would just go to the COMPONENTS/layouts/VIEW/VIEW_left.php file and add custom code there (via "/[INSERT<>$$$$]/" or "/[REPLACE<>$$$$]/" codes).
However, I'm wondering if there is a better (safer) way to update these layout files without these custom code inserts/replacements?
The tabs will basically just be changed for structure and layout, with some additional HTML items, but will still have fields on them that need to be submitted when the item is saved.
I've tried creating custom admin tab, as well as Templates and Layouts (which don't seem to work with admin views that I could tell).
Any ideas how you do modifications to layouts of admin tabs?
Beta Was this translation helpful? Give feedback.
All reactions