Snippets

Create an account or login to be able to add, comment and rate snippets.

Navigation

Specify another method than toString() to call in object_select_tag

In an object_select_tag, the toString() method is automacally called to display the object in the list.

Sometimes, you can't use the same method for diffrent list on the same objects, so you have to specify wich method to call.

So this is the tip : 'text_method' => 'theMethodToCall'

object_select_tag($my_object, 'myMethod', array (
  'related_class' => 'MyObjectClass',
  'text_method' => 'getCompleteDescription'
))
by whoknows on 2007-07-10, tagged helper  objecthelper 

Comments on this snippet

gravatar icon
#1 excessive demon on 2007-07-13 at 05:11

ok

You need to create an account or log in to post a comment or rate this snippet.