Ejemplo n.º 1
0
 static function generateTranslationFieldsForBackend($segment, array $db, array $has_one = null, FieldSet $fieldset)
 {
     return $fieldset;
     if (isset($has_one)) {
         $hasOne = array();
         foreach ($has_one as $field => $type) {
             $fieldName = $field . "ID";
             $hasOne[$fieldName] = $type;
             $fieldset->renameField($fieldName, _t($segment, "%{$field}%"));
         }
     }
     foreach ($db as $field => $type) {
         $fieldset->renameField($field, _t($segment, "%{$field}%"));
     }
     return $fieldset;
 }
 function testRenameField()
 {
     $fields = new FieldSet();
     $nameField = new TextField('Name', 'Before title');
     $fields->push($nameField);
     /* The title of the field object is the same as what we put in */
     $this->assertSame('Before title', $nameField->Title());
     /* The field gets renamed to a different title */
     $fields->renameField('Name', 'After title');
     /* The title of the field object is the title we renamed to, this
     			includes the original object we created ($nameField), and getting
     			the field back out of the set */
     $this->assertSame('After title', $nameField->Title());
     $this->assertSame('After title', $fields->dataFieldByName('Name')->Title());
 }