dev-master
9999999-devTranslatable Enum fieldtype for Silverstripe.
The Requires
silverstripe i18n translatable enum
Translatable Enum fieldtype for Silverstripe.
Translatable Enum fieldtype, (*1)
Elvinas LiutkeviÄius, (*2)
SilverStripe 3, (*4)
Simply install the module using the standard method., (*5)
Now you can create datafield with translatable enum Field:, (*6)
class MyDataObject extends DataObject { public static $db = array( 'DbField' => "i18nEnum('default, other', 'default')", ); }
To get translated Enum value in GridField, you need to return the value in this way:, (*7)
class MyDataObject extends DataObject { ... public function DbField() { return i18nEnum::getTranslatedValue($this->className, __FUNCTION__, $this->{__FUNCTION__}); } }
By default translation namespace will be your DataObject class name and the entity will be constructed like this: "db_{DbField}_{enum value}". So your translation file should look like this:, (*8)
lang: MyDataObject: db_DbField_default: 'Default' db_DbField_other: 'Other'
Translatable Enum fieldtype for Silverstripe.
silverstripe i18n translatable enum