Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Should $summary_fields be able to pass arguments to methods? #2896

Closed
kinglozzer opened this Issue · 4 comments

4 participants

Loz Calver Andrew Short Damian Mooyman Simon Welsh
Loz Calver
Collaborator

For example:

private static $summary_fields = array(
    'Author' => 'Author',
    'Content.LimitCharacters(50)' => 'Content'
);
Andrew Short

My preference is to move away from this kind of eval-ish syntax towards using anonymous functions, any thoughts on that?

Loz Calver
Collaborator

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.

Andrew Short

My preference would be for people to override summaryFields for complex situations like this.

Simon Welsh simonwelsh added the 3.1 label
Loz Calver kinglozzer closed this
Damian Mooyman
Collaborator

Just make a method that returns the summary in the format you expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.