[Fwd: [PEAR-DEV] DB_DataObject_FormBuilder: select_display_field improvements]

From: Date: Sat, 24 Jan 2004 02:37:10 +0000
Subject: [Fwd: [PEAR-DEV] DB_DataObject_FormBuilder: select_display_field improvements]
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-25246@lists.php.net to get a copy of this message
Hello, If you didn't read my past 2 mails in this thread, do NOT do it (if you did: I solved version d). Here's a patch (attached), FormBuilder will be able to do the following things when applied: The current version of FormBuilder can handle two type of $select_display_fields: a) $select_display_field = 'country'; (country is a field name) b) $select_display_field = array('country', 'lang'); (country, lang are field names) output: <option value=1>USA, English</option> (output format is not configurable) This patch gives these new functionalities: c) $select_display_field = '{country} (language: {lang})'; (country and language are field names) output1: <option value=1>USA (language: English)</option> output2: <option value=2>Germany (language: German)</option> d) $select_display_field = '{country} (language: {lang_id->name})'; output1: <option value=1>USA (language: English)</option> output2: <option value=2>Germany (language: German)</option> In this example lang_id->name refers to the "name" field of a linked table ("languages"; specified in db.links.ini). Links will be automagically resolved. Unlimited level of links (field1->table2_field->...->tableN_field) supported. Allocated memory is freed (unset()'d) as soon as possible. BC-safe! (as long as field names don't contain '{' '}' '->') BE SURE TO USE {} AND -> CORRECTLY (be sure to use existing field names, set up links in db.links.ini properly, don't interleave {} blocks, be sure to open and close them well etc). Hope I spared some hours of development time for you. (patch valid for FormBuilder.php CVS version 1.21 by mw21st) Regards, Norbert

« previous php.pear.dev (#25246) next »