<p>The error points to a missing corresponding field with handle 'something' in the entry model. </p>

CC BY-SA 3.0
2017-03-20T09:06:09.773Z
2017-03-20T09:06:09.773Z
Frank
<p>What I'm looking for is to add in a custom column that either has a checkmark or not based on if the entry's slug has a certain set of characters.</p>

<p>Example:</p>

<p>This would get a check: <code>sluggyslug-SC_01234X</code></p>

<p>This would not: <code>sluggyslug</code></p>

<p>I would be looking at the slug and matching via regex for the <code>SC_XXXXX</code> portion.</p>

<p>I see there is the hook <code>defineAdditionalEntryTableAttributes</code> and <code>getEntryTableAttributeHtml</code> but I get an error when I try to set them.</p>

<p>The code I tried in my plugin:</p>

<pre><code>public function defineAdditionalEntryTableAttributes()
{
    return array(
        'something' =&gt; "Some Column",
    );
}

public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)
{
    if ($attribute == 'something')
    {
        if (preg_match("/(?:SC_\w{5})$/", $entry-&gt;slug)) {
          return '&lt;div class="center"&gt;&amp;#x2713;&lt;/div&gt;';
        }
    }
}
</code></pre>

<p>If I try to add the column, I just get this via the <code>getElements</code> ajax call.</p>

<pre><code>CException
Property "Craft\EntryModel.something" is not defined.
</code></pre>

<p>Is there anyway to add a column like this?</p>

<plugin-development>
Add a column to entries list using defineAdditionalEntryTableAttributes?
# Add a column to entries list using defineAdditionalEntryTableAttributes?

(Asked by: username_0 on 2016-06-08)

What I'm looking for is to add in a custom column that either has a checkmark or not based on if the entry's slug has a certain set of characters.
Example:
This would get a check: sluggyslug-SC_01234X
This would not: sluggyslug
I would be looking at the slug and matching via regex for the SC_XXXXX portion.
I see there is the hook defineAdditionalEntryTableAttributes and getEntryTableAttributeHtml but I get an error when I try to set them.
The code I tried in my plugin:
public function defineAdditionalEntryTableAttributes()
{
    return array(
        'something' => "Some Column",
    );
}

public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)
{
    if ($attribute == 'something')
    {
        if (preg_match("/(?:SC_\w{5})$/", $entry->slug)) {
          return '✓';
        }
    }
}

If I try to add the column, I just get this via the getElements ajax call.
CException
Property "Craft\EntryModel.something" is not defined.

Is there anyway to add a column like this?

**Tags:** plugin-development

---

## 1 answers

### Answer by username_1 on 2017-03-20. Score: 1

The error points to a missing corresponding field with handle 'something' in the entry model.


---

