Is it possible to change core elements index pages -like entry index page- by plugin in PHP way, like extending their twig, using events, hooks and not manipulating DOM with Javascript?

Currently only way i know is to register a JS file for those pages and add HTML via Javascript.

  • I'm voting to close this question as off-topic because it doesn't seem to be craft-related
    – kmgdev
    Oct 25, 2019 at 21:06
  • 1
    @kmgdev why do you think that entries, twig template, template hook or events is not related to craft cms?
    – user9975
    Oct 26, 2019 at 11:07
  • 1
    I don't find this off-topic, it most definitely is Craft-related. To the question – I don't think you can actually change the core code. It might be that you'd be better off copying the template from core and make the changes you want, and make a CP page for it.
    – KSP
    Oct 28, 2019 at 12:58
  • @KSP thanks, are you suggesting to redirect pages like entries/{sectionname} which is a element index page to my page via rules or controller map by custom plugins? it seems it is a solution but a little bit hacky to me. could you possibly post your answer plz?
    – user9975
    Oct 28, 2019 at 13:13
  • I haven't really tested any of it myself, so I'm just guessing a bit, so I don't feel it really fit for an answer. As far as I know, there is no way to reach into other templates directly, that's why I thought it's better to extend it, or simply copy it and make the changes you want. It seems that the actual index is built via a JS call in /vendor/craftcms/cms/src/templates/_layouts/elementindex.html and rendered in /vendor/craftcms/cms/src/templates/_elements/elementindex.html
    – KSP
    Oct 28, 2019 at 13:55


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.