jkersu

Im trying to shown an extra DB field that I've added to a DataObject via DataExtension as a Summary Field but it's returning the error: Array to String conversion. Can anyone see what I'm doing wrong? I feel like its something obvious:

  1. private static $db = [
  2. 'AccountTypes' => 'Varchar(255)',
  3. ];
  4. private static $summary_fields = [
  5. 'AccountTypes'
  6. ];
  7. private static $field_labels = [
  8. 'AccountTypes' => 'Account Types'
  9. ];
jkersu

Weird: Renaming the DB field to something else fixed it

Nemanja Karadzic

do you by any chance have a method on that data object that goes by the name of AccountTypes or getAccountTypes which returns an array?

rasmniel

I'm trying to rename a field from the Silverstripe Blogs module (the Blog->BlogPosts field), but I can't for the life of me figure out how. I have tried getCMSFields , updateCMSFields , and beforeUpdateCMSFields , but none of them seem to be able to read the given field from the FieldList in the context, always returning NULL with calls like $fields->dataFieldByName('BlogPosts') and $fields->fieldByName('BlogPosts'). I've even tried looking for it through an extension using updateCMSFields Does anyone have a tip to how I can change the CMS label for this field?

rasmniel

The grid field is the field I'm trying to rename, but I can't find either of the two 🤔

wmk

"rename" -> another label in the CMS for the customer? Or do you need to rename the actual DB field or relation?

rasmniel

Also, when looking in the module code I can't find anywhere the field is actually explicitly added, which makes me think something exceptional is done to add the field.

rasmniel

@wmk Just the label, so the field will be labelled "Events" rather than "Blog Posts"

wmk

Blog module uses lumberjack to add the grid

rasmniel

I'm assuming that has some effect on the field-generation then? I am not familiar with lumberjack.