Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
kinglozzer opened this Issue · 4 comments

4 participants

@kinglozzer
Collaborator

For example:

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

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

@kinglozzer
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.

@ajshort

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

@simonwelsh simonwelsh added the 3.1 label
@kinglozzer kinglozzer closed this
@tractorcow
Owner

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.