1

I am trying to get access to the attribute title using this, but does not work. If I switch out 'title' for slug, uri, etc. It works. But not title. Anyway I can do this?

public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)
{    
    switch ($attribute) {
        case 'title':
            return $entry->title . ': Something appended to title';
            break;
    }
}

Update

Added in return $entry->title . ': Something appended to title'; to the case to show I want to append something to the title.

I want to be able to just append some text, icon, or html to the titles in the entries list in the CP.

1

If you wanna change the title one way is override the __toString() method on your model.

/**
 * @return string
 */
public function __toString()
{
    return (string)$this->name;
}

If you wanna chage the status icon next to the title you can override the getElementQueryStatusCondition function on your ElementType class

public function getElementQueryStatusCondition(DbCommand $query, $status)
{}

Regards

| improve this answer | |
  • I don't follow the __toString() part. I updated my code a tiny bit. I want to be able to just append some text, icon, or html to the titles in the entries list in the CP. – Erik Jun 9 '16 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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