Answers.Body: <p>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:</p>
  
  <p><code>craft/app/templates/_layouts/elementindex.html</code></p>
  
  <p>However, its important to know that you should only be using the <code>elementindex</code>if you are creating a custom element type.</p>
  
  <p>As far as the <code>element index</code>, a good portion of the options are actually set through Javascript by Craft using <a href="https://github.com/pixelandtonic/Garnish" rel="nofollow noreferrer">Garnish</a>. If you look at the following code, you can see that the status, template side, is set via Garnish. </p>
  
  <pre><code>{% 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 %}
  </code></pre>
  
  <p>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:</p>
  
  <ol>
  <li><a href="https://craftcms.stackexchange.com/questions/907/how-to-integrate-custom-statuses-in-a-workflow-style-custom-element-type">How to integrate custom statuses in a workflow style custom element type?</a></li>
  <li><a href="https://craftcms.stackexchange.com/questions/1097/best-way-to-use-custom-enums-in-my-plugin-templates">Best way to use custom enums in my plugin templates?</a></li>
  <li><a href="https://craftcms.stackexchange.com/questions/887/best-way-to-implement-my-own-statuses-on-my-custom-element-type">Best way to implement my own statuses on my custom element type?</a></li>
  </ol>
  
  <p>As for Craft documentation, they are working on it still and the only thing available right now is this: </p>
  
  <p><a href="http://buildwithcraft.com/docs/plugins/working-with-elements#creating-new-element-types" rel="nofollow noreferrer">Creating new Element Types</a> </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T21:24:17.877Z
Answers.Text: 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
Answers.UserDisplayName: pythic
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T21:57:01.853Z
Answers.Text: 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`.
Answers.UserDisplayName: Jason McCallister
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-05T13:55:06.990Z
Answers.Text: Seeing as this is over 5 years old and I assume for Craft2, does anyone know if this has changed and if there is documentation?
Answers.UserDisplayName: Darryl Hardin
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-27T20:40:02.207Z
Answers.LastActivityDate: 2014-07-27T20:40:02.207Z
Answers.LastEditDate: 2017-04-13T12:51:00.253Z
Answers.UserDisplayName: Jason McCallister
Body: <p>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? </p>
  
  <p>Thanks in advance</p>
  
Tags: <templating><entries><index><garnish>
Title: Any documentation about the elementindex template available?
ThreadText: # Any documentation about the elementindex template available?
  
  (Asked by: username_0 on 2014-07-27)
  
  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
  
  **Tags:** templating, entries, index, garnish
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-07-27. Score: 4
  
  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:
  
  `craft/app/templates/_layouts/elementindex.html`
  
  However, its important to know that you should only be using the `elementindex`if 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](https://github.com/pixelandtonic/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?](https://craftcms.stackexchange.com/questions/907/how-to-integrate-custom-statuses-in-a-workflow-style-custom-element-type)
  2. [Best way to use custom enums in my plugin templates?](https://craftcms.stackexchange.com/questions/1097/best-way-to-use-custom-enums-in-my-plugin-templates)
  3. [Best way to implement my own statuses on my custom element type?](https://craftcms.stackexchange.com/questions/887/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](http://buildwithcraft.com/docs/plugins/working-with-elements#creating-new-element-types)
  
  > **Comments:**
  > **username_0**: 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  
  > **username_1**: 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`.  
  > **username_2**: Seeing as this is over 5 years old and I assume for Craft2, does anyone know if this has changed and if there is documentation?  
  
  ---
  
  