Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to hook into generic CP page output production after session has started #1557

Open
1 task done
jcogs-design opened this issue Nov 11, 2021 · 4 comments · Fixed by #3269 · May be fixed by #3443
Open
1 task done

Add ability to hook into generic CP page output production after session has started #1557

jcogs-design opened this issue Nov 11, 2021 · 4 comments · Fixed by #3269 · May be fixed by #3443
Labels
enhancement New feature or request

Comments

@jcogs-design
Copy link
Contributor

Add / amend EE so that either / or:

  • the cp_end_js hook fires after the session is started (so member info can be accessed)
  • add a hook with similar function to template_post_parse that fires when a CP page is generated

Either of these options would provide some mechanism to add dynamic elements to a generic CP page that could reflect (for example) the role / status of the member currently logged in: something that appears not to be possible currently.

  • I am capable and would like to work on implementation of this feature if it is considered.
@jcogs-design jcogs-design changed the title Add ability to hook into generic CP page output after session has started Add ability to hook into generic CP page output production after session has started Nov 11, 2021
@intoeetive
Copy link
Contributor

@jcogs-design It's been a while since this was requested, but I think we could add cp_boot hook similar to existing core_boot with the difference that it will be run after ee()->core->run_cp()

Do you think that will cover what you need here?

@intoeetive intoeetive added the enhancement New feature or request label Apr 12, 2023
@jcogs-design
Copy link
Contributor Author

To be honest I'm not aware of the core_boot hook - as mentioned in opening post what would work would be anything that allows a process to be run after the member status has been determined: the request came from a need to put a marker on a CP page depending on role of logged in member - currently the only way we found was to load a trigger element that fired a js process after template was constructed that ran an ajax job to determine current role and the insert html into page based on what that determined; a solution that is rather long-winded and would not work for some purposes. A better option would be something equivalent to template_post_parse for the CP HTML generation - so amendments / additions could be made based on logged in status etc.

@intoeetive
Copy link
Contributor

So for this case, you actually need the hook to run after the views have been compiled (or at least fetched), so you could inject your own HTML there, is that correct?

With the cp_boot you'd be able to set variables to ee()->view or load JS with ee()->cp->add_js_script or add CSS to head with ee()->cp->add_to_head - but not modify the compiled view files, because that would be happening later on. But you would already know who's logged in

@jcogs-design
Copy link
Contributor Author

OK - sounds like that might work.

intoeetive added a commit that referenced this issue Apr 13, 2023
intoeetive added a commit that referenced this issue May 8, 2023
intoeetive added a commit that referenced this issue May 24, 2023
@intoeetive intoeetive linked a pull request May 24, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants