Page 1 of 2

How to change things in Admin

Posted: Fri Mar 20, 2026 3:42 pm
by Dan Cole
@burt
Gary can you talk a little bit about how to make changes to admin files and protect the changes from being overridden on updates? I recently installed a new version of Phoenix to use as a test/staging site that will eventually end up replacing my older Phoenix live site. I'd like to make all my updates to the staging site in such a way that I can eliminate as much work as possible as I move along with additional updates. I understand how to handle changes on the shop side but I'm not sure if the same sort of approach will work for the admin files. As an example I was just updating the modal size used in /XXXadminXXX/includes/actions/outgoing/infoboxes/default.php to add modal-lg to the modal-dialog class. A pretty simple change but I want it preserved for the future and would like to start off using the best practice when making changes like this.

Dan

Re: Adding Images to Index and CSS not working on Mobile

Posted: Fri Mar 20, 2026 10:24 pm
by Omar_one
Dan Cole wrote: Fri Mar 20, 2026 3:42 pm @burt
Gary can you talk a little bit about how to make changes to admin files and protect the changes from being overridden on updates? I recently installed a new version of Phoenix to use as a test/staging site that will eventually end up replacing my older Phoenix live site. I'd like to make all my updates to the staging site in such a way that I can eliminate as much work as possible as I move along with additional updates. I understand how to handle changes on the shop side but I'm not sure if the same sort of approach will work for the admin files. As an example I was just updating the modal size used in /XXXadminXXX/includes/actions/outgoing/infoboxes/default.php to add modal-lg to the modal-dialog class. A pretty simple change but I want it preserved for the future and would like to start off using the best practice when making changes like this.

Dan
@burt maybe move this to a new topic

@Dan Cole here any example
- use a JavaScript hook ( Adds the modal-lg) and centering without core edits)

Code: Select all

<script>
  /**
   * Automatically upgrades the modal classes without touching core PHP
   */
  document.addEventListener("DOMContentLoaded", function() {
    const modalDialog = document.querySelector('#emailModal .modal-dialog');
    if (modalDialog) {
        // Adds the modal (lg) and centering without core edits
        modalDialog.classList.add('modal-lg', 'modal-dialog-centered');
    }
  });
</script>
here is the whole hook

Code: Select all

<?php
class hook_admin_outgoing_inline_css {
  
 public function listen_injectSiteEnd() {
       
        $admin_css =  <<<EOD
<style>
    /* Premium "Midnight & Cyan" Theme */
    #emailModal .modal-content {
        border: none;
        border-radius: 24px;
        box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
        overflow: hidden;
    }

    #emailModal .modal-header {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
        color: #f8fafc;
        padding: 1.5rem 2rem;
        border-bottom: 4px solid #38bdf8; /* Nice Cyan accent */
    }

    #emailModal .modal-title {
        font-weight: 800;
        font-size: 1.4rem;
    }

    #emailModal .btn-close {
        filter: invert(1) brightness(200%);
        opacity: 0.8;
    }

    #emailModal .modal-body {
        padding: 2.5rem;
        font-size: 1.15rem;
        line-height: 1.7;
        color: #334155;
    }
</style>

<script>
  /**
   * Automatically upgrades the modal classes without touching core PHP
   */
  document.addEventListener("DOMContentLoaded", function() {
    const modalDialog = document.querySelector('#emailModal .modal-dialog');
    if (modalDialog) {
        // Adds the modal (lg) and centering without core edits
        modalDialog.classList.add('modal-lg', 'modal-dialog-centered');
    }
  });
</script>
EOD;
 
        return $admin_css;
    }
  }

here how it look

Re: Adding Images to Index and CSS not working on Mobile

Posted: Sat Mar 21, 2026 10:12 am
by burt
I will separate this out so as not to confuse AstecModels (too much!)

Re: Adding Images to Index and CSS not working on Mobile

Posted: Sat Mar 21, 2026 10:20 am
by burt
The admin side is more about the following;

- new pages
- new views of existing pages
- hooks

Take for example the recent mod in the Co-op, that `keep an archive of outgoing emails`.

Class override to store sent emails rather than delete them.
Hook manipulates existing outgoing.php default view to remove archived emails
Hook manipulates existing outgoing.php page to add a Button to a new view
New View to show archived emails

It is true that we are still not at 100% no core code touching, but it is close.

Re: How to change things in Admin

Posted: Sat Mar 21, 2026 12:31 pm
by Dan Cole
I'm a bit confused (but that is my normal operating state :D) ....are you are saying you can't just override admin files?

Dan

Re: How to change things in Admin

Posted: Sat Mar 21, 2026 12:40 pm
by burt
Admin doesn’t support overrides like the catalog does. It's built around hooks and extending functionality, so you generally work that way and only touch core when there’s no alternative.

You might like to give an example of something you are trying to do?

Re: How to change things in Admin

Posted: Sat Mar 21, 2026 2:46 pm
by Dan Cole
Thanks Gary. Here is the example in my initial post. My goal (not for the example) was to simply preserved any changes I might make on an ongoing basis so I didn't lose them on future updates. Since we can't do simple overrides I'll probably set up a pretend override directory structure for the admin side and copy files that I change there so they aren't lost and then I can simply pull them into any new versions of Phoenix that I install. It would probably allow me to see what fails on the updates as well, so maybe that'll be a good way forward.
As an example I was just updating the modal size used in /XXXadminXXX/includes/actions/outgoing/infoboxes/default.php to add modal-lg to the modal-dialog class. A pretty simple change but I want it preserved for the future and would like to start off using the best practice when making changes like this.
Dan

Re: How to change things in Admin

Posted: Sat Mar 21, 2026 2:48 pm
by burt
Omar gave a solution for that :?: :!: :?: :+1:

Do you have a `harder` example ?

Re: How to change things in Admin

Posted: Sat Mar 21, 2026 2:53 pm
by Dan Cole
@Omar_one Thanks.
use a JavaScript hook ( Adds the modal-lg) and centering without core edits)
From my point of view that's a little over the top for such a simple change and I think I'll just try my pretend override directory approach to keep track of what changes I make on the admin side of things.

I appreciate you and your taking to time to post. Thanks again.

Dan

Re: How to change things in Admin

Posted: Sat Mar 21, 2026 3:02 pm
by Dan Cole
Do you have a `harder` example ?
Not of the top of my head but I've made lots of them (maybe even more than on the shop side) and will no doubt come across them as my new staging site evolves. I think a combination of hooks and my simpleton approach will work fine for me, if I can remember to copy over the files when needed. :o

Dan