-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] New behaviour property to populate the virtual name #171
base: master/elche
Are you sure you want to change the base?
Conversation
Adds a new behaviour property that give the ability to populate the virtual name with something other than the title. The value of this new behaviour property can be either a property or a method of the model.
if (!empty($this->_properties['populate_property'])) { | ||
if (isset($item->{$this->_properties['populate_property']})) { | ||
return $item->{$this->_properties['populate_property']}; | ||
} elseif (method_exists($item, $this->_properties['populate_property'])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would have done the other way around : give priority to method and then to property.
It needs to accept a closure to allow dynamic insertion of the behaviour imo. |
Indeed, using closure must be possible if methods added by behaviours are not recognized by "method_exists". |
@Meroje & @vrcAlbert 👍 |
1 similar comment
@Meroje & @vrcAlbert 👍 |
…regenerate after creation (eg. for populating an url with the item ID)
PR updated :
Todo: implement a mechanism in the renderer's javascript to observe fields and regenerate the virtual name when they change (currently only the title is observed). |
b52d845
to
9631c5f
Compare
Adds a new behaviour property that gives the ability to populate the virtual name with something other than the title. The value of this new behaviour property can be either a property or a method of the model.
Be careful, this new property will not affect the javascript part of the renderer that will always use the title to dynamically generates the virtual name.
To make it work with the renderer we need to rethink the way the virtual name is dynamically generated in javascript (eg. with an ajax call).