Merge pull request #664 from nlegoff/fix_1343

[3.8] Fix #1343 Display default name if label is empty
This commit is contained in:
Romain Neutron
2013-10-01 02:48:09 -07:00
2 changed files with 4 additions and 1 deletions

View File

@@ -497,7 +497,7 @@ class databox_field implements cache_cacheableInterface
throw new InvalidArgumentException(sprintf('Code %s is not defined', $code));
}
return isset($this->labels[$code]) ? $this->labels[$code] : $this->name;
return isset($this->labels[$code]) && '' !== $this->labels[$code] ? $this->labels[$code] : $this->name;
}
/**

View File

@@ -348,6 +348,9 @@ class databox_fieldTest extends PhraseanetPHPUnitAbstract
$this->object_mono->set_label($code, null)->save();
$this->assertEquals($this->object_mono->get_name(), $this->object_mono->get_label($code));
$this->object_mono->set_label($code, '')->save();
$this->assertEquals($this->object_mono->get_name(), $this->object_mono->get_label($code));
}
public function provideLanguageCodes()