private static $summary_fields = array(
'Author' => 'Author',
'Content.LimitCharacters(50)' => 'Content'
My preference is to move away from this kind of eval-ish syntax towards using anonymous functions, any thoughts on that?
I agree that it would be a cleaner solution, there’s probably more margin for error using this syntax than anonymous functions as well. However, we can’t use class properties to configure it which makes the implementation much less simple for developers.
Any ideas on how/where you’d define your anonymous functions? You could override summaryFields(), but you can already do that anyway.
My preference would be for people to override summaryFields for complex situations like this.
Just make a method that returns the summary in the format you expect.