I am looking to see if there is an easy way or already a plugin available that would replicate the entries structure layout. I plan on creating a plugin that would allow an admin to mass update a select set of fields.

I notice it does an ajax call to index.php?p=admin/actions/elementIndex/getElements to get the first 50 entries and then subsequent calls to get more as you get near the end of the results.

I see one of 3 potential ways to do it and wondering which way would be ideal.

  1. Try and call this same ajax call as it returns the html and do some manipulation to the html to add additional functionality I need.

  2. Find methods that are being called from craft core and copy them into my plugin and modify as needed then do similar ajax call to my plugin.

  3. Just write my own custom code to grab what I need.

I am leaning on number 2 as the ideal scenario but have not looking to see if this is unreasonable as it may be tied to a lot of different areas of the core code.

Looking to get some opinions as I am guessing others have already gone down this road.


UPDATE with more info

I want to mimic the entries admin structure layout page for a specific section. Once I mimic it I will add a little different functionality to it. So currently you can select multiple entries and mass update the status or delete those entries and that is it. I plan to add some additional options to change some custom fields that are associated with that section. So if I am in the admin and I go to /admin/entries/meetings and meetings is a section with a type of structure I would see the tree layout of all the meetings in my case it is 5 levels deep. There are 3 custom fields that change monthly and when they change about 30% of the meetings setup need to be changed. The idea is they could select all of them that need these 3 fields updated and can do a mass update. Currently they have to go into each meeting and make the change which is very time consuming. Hope that makes more sense.

  • What do you mean exactly by "replicate entries structure layout". Do you want to create a new section with the same entries like an existing? Or do you just want to resave all elements (which can be done with an already existing function) Commented Apr 4, 2018 at 16:00
  • Left some more details of what I am looking for.
    – Chris
    Commented Apr 4, 2018 at 16:12

1 Answer 1


Seems like you want to create a custom Element or you would like to extend the existing Entry Element. It is all stated in the docs You can see how to create custom actions as well here

Here is stated how to create a custom index page

{% extends '_layouts/elementindex' %}
{% set title = 'Products' %}
{% set elementType = 'ns\\prefix\\elements\\Product' %}

You can then extend the BaseElementIndex in order to change Javascript functionality

Craft.elementIndex = Craft.createElementIndex('{{ elementType|e("js") }}', $('#main'), {
    context:        '{{ context }}',
    storageKey:     'elementindex.{{ elementType }}',
    criteria:       Craft.defaultIndexCriteria

You can as well make use of certain events like

Event::on(Elements::class, Elements::EVENT_AFTER_SAVE_ELEMENT, function($event){
    // resave all other elements
  • Thanks. I think is leading down the right path so I will accept it as the answer. Appreciate it.
    – Chris
    Commented Apr 4, 2018 at 18:32

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.