What would cause an custom element listing to just return everything? I'm creating a plugin with its own ElementType, i've been using the Events plugin by P&amp;T for reference, so I thought everything was going fine.

Now when I go to my elements index, I seem to just get a listing for all elements, regardless of anything. What could cause this? I have my element type in my template like

{% set elementType = 'Custom_ElementType' %}


So if I change this to

{% set elementType = 'Entry' %}


I get a list of all entries with the correct sections and whatnot, which is what I expect, but when I change it to the former I get this:



I've obviously overlooked something but I can't figure it out, if anyone else has overcome something similar i'd be grateful for any pointers.

Update

Here is the code i'm using:

Plugin_FooElementType.php

&lt;?php
namespace Craft;

class Plugin_FooElementType extends BaseElementType
{
  public function getName()
  {
    return Craft::t('Foo Element');
  }
  public function getSources($context = null)
  {
    $sources = array(
      '*' =&gt; array(
       'label' =&gt; Craft::t('All sources')
      )
    );
    return $sources;
  }

  public function populateElementModel($row)
  {
    return Plugin_FooModel::populateModel($row);
  }

  public function defineTableAttributes($source = null)
  {
    return array(
     'id' =&gt; Craft::t('ID'),
     'handle' =&gt; Craft::t('Handle'),
     'path' =&gt; Craft::t('Path'),
    );
  }
}


_index.html

{% extends "_layouts/elementindex" %}
{% set title = "Endpoints"|t %}

{% set elementType = 'Plugin_Foo' %}

{% set tabs = {
  events:    { label: "Events"|t, url: url('events') },
  requets: { label: "Requests"|t, url: url('plugin/foos') }
} %}


Plugin_FooModel.php

&lt;?php
namespace Craft;

class Plugin_FooModel extends BaseElementModel
{
 protected $elementType = 'Plugin_Foo';


 protected function defineAttributes()
 {
    return array_merge(parent::defineAttributes(), array(
        'requestId' =&gt; AttributeType::Number,
        'handle' =&gt; AttributeType::Handle,
        'path' =&gt; AttributeType::String,
    ));
 }

 public function getCpEditUrl()
 {
    $relation = $this-&gt;getRelation();
    if ($relation)
    {
        return UrlHelper::getCpUrl('plugin/'.$relation-&gt;handle.'/'.$this-&gt;id);
    }
 }


 public function getRelation()
 {
    if ($this-&gt;relatedId)
    {
        return craft()-&gt;plugin-&gt;getRelationById($this-&gt;relatedId);
    }
 }
}
It is likely just a typo in your template. Can you ensure that if your element type class name is of the format Custom_PluginElementType that your template code is then in the following format:

{% set elementType = 'Custom_Plugin' %}


Or if your element type class name is of the format CustomElementType that your template code is then in the following format:

{% set elementType = 'Custom' %}