Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to customise the elementindex view. For example I want to filter out some entries that don't match certain criteria. Also if possible add some hooks to the read calls. Is there any documentation available about this?

Thanks in advance

share|improve this question

Your best bet on learning element type templating is to look at Craft template itself. Element types use the following template for controlling the layout:


However, its important to know that you should only be using the elementindexif you are creating a custom element type.

As far as the element index, a good portion of the options are actually set through Javascript by Craft using Garnish. If you look at the following code, you can see that the status, template side, is set via Garnish.

{% block initJs %}
Craft.createElementIndex('{{ elementTypeClass }}', $('#main'), {
    context:        '{{ context }}',
    showStatusMenu: {{ showStatusMenu is defined ? showStatusMenu|json_encode|raw : "'auto'" }},
    showLocaleMenu: {{ showLocaleMenu is defined ? showLocaleMenu|json_encode|raw : "'auto'" }},
    storageKey:     'elementindex.{{ elementTypeClass }}',
    criteria:       { localeEnabled: null }
{% endblock %}

You can set custom statuses on your element type, if that is the route you are looking to travel. I have dug into element types and custom statuses on these posts:

  1. How to integrate custom statuses in a workflow style custom element type?
  2. Best way to use custom enums in my plugin templates?
  3. Best way to implement my own statuses on my custom element type?

As for Craft documentation, they are working on it still and the only thing available right now is this:

Creating new Element Types

share|improve this answer
can you please explain: "However, its important to know that you should only be using the elementindexif you are creating a custom element type."? I'm basically trying to load an entries list inside one of my plugins' tabs – pythic Jul 27 '14 at 21:24
Sure thing, the elementindex is used specifically for returning elements (Entries, Users, Assets and etc.). Therefore in the beginning of the template it expects you to declare elementTypeClass. So if you are not using a custom element type, there is a little extra work as a lot of these options are set on your elementtypes/PluginNameElementType.php. – Jason McCallister Jul 27 '14 at 21:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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