Skip to content

Instantly share code, notes, and snippets.

@jesseschutt
Last active August 29, 2015 14:21
Show Gist options
  • Save jesseschutt/adea2793456b25616f6b to your computer and use it in GitHub Desktop.
Save jesseschutt/adea2793456b25616f6b to your computer and use it in GitHub Desktop.
// ----
public function modifyEntryTableAttributes(&$attributes, $source)
{
if ($source == 'zcstalecontent:stale_content')
{
unset($attributes['expiryDate']);
// zcContentData is my custom field. It has a Date/Time field and a text field
// that is grouped into it's own table.
// This is what appears to be the problem:
// zcContentData is returning an array from my custom field when I want it
// to return just the date, or $zcContentData['zcDate']
$attributes['zcContentData'] = Craft::t('ZC Date');
}
}
// ----
public function getEntryTableAttributeHtml(EntryModel $entry, $attribute)
{
if ($attribute == 'zcContentData')
{
// This works. It returns an array from my custom field (zcContentData)
$fieldData = $entry->zcContentData;
if (!empty($fieldData)) {
// This works. If the entry has zcContentData then this returns
// the date specifically.
return $fieldData['zcDate'];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment