Commit 82d059aa authored by alexpott's avatar alexpott

Issue #2248505 by leevingo, Berdir: Improve property definition labels.

parent 383521f2
......@@ -32,7 +32,7 @@ class EmailItem extends FieldItemBase {
*/
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['value'] = DataDefinition::create('email')
->setLabel(t('Email value'));
->setLabel(t('E-mail'));
return $properties;
}
......
......@@ -65,16 +65,16 @@ public static function propertyDefinitions(FieldStorageDefinitionInterface $fiel
// @todo: Lookup the entity type's ID data type and use it here.
// https://drupal.org/node/2107249
$target_id_definition = DataDefinition::create('integer')
->setLabel(t('Entity ID'))
->setLabel(t('@label ID', array($target_type_info->getLabel())))
->setSetting('unsigned', TRUE);
}
else {
$target_id_definition = DataDefinition::create('string')
->setLabel(t('Entity ID'));
->setLabel(t('@label ID', array($target_type_info->getLabel())));
}
$properties['target_id'] = $target_id_definition;
$properties['entity'] = DataReferenceDefinition::create('entity')
->setLabel(t('Entity'))
->setLabel($target_type_info->getLabel())
->setDescription(t('The referenced entity'))
// The entity object is computed out of the entity ID.
->setComputed(TRUE)
......
......@@ -29,7 +29,7 @@ class FloatItem extends NumericItemBase {
*/
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['value'] = DataDefinition::create('float')
->setLabel(t('Float value'));
->setLabel(t('Float'));
return $properties;
}
......
......@@ -55,7 +55,7 @@ public static function defaultFieldSettings() {
*/
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['status'] = DataDefinition::create('integer')
->setLabel(t('Comment status value'));
->setLabel(t('Comment status'));
$properties['cid'] = DataDefinition::create('integer')
->setLabel(t('Last comment ID'));
......
......@@ -98,10 +98,11 @@ public static function propertyDefinitions(FieldStorageDefinitionInterface $fiel
$properties = parent::propertyDefinitions($field_definition);
$properties['display'] = DataDefinition::create('boolean')
->setLabel(t('Flag to control whether this file should be displayed when viewing content'));
->setLabel(t('Display'))
->setDescription(t('Flag to control whether this file should be displayed when viewing content'));
$properties['description'] = DataDefinition::create('string')
->setLabel(t('A description of the file'));
->setLabel(t('Description'));
return $properties;
}
......
......@@ -139,16 +139,20 @@ public static function propertyDefinitions(FieldStorageDefinitionInterface $fiel
$properties = parent::propertyDefinitions($field_definition);
$properties['alt'] = DataDefinition::create('string')
->setLabel(t("Alternative image text, for the image's 'alt' attribute."));
->setLabel(t('Alternative text'))
->setDescription(t("Alternative image text, for the image's 'alt' attribute."));
$properties['title'] = DataDefinition::create('string')
->setLabel(t("Image title text, for the image's 'title' attribute."));
->setLabel(t('Title'))
->setDescription(t("Image title text, for the image's 'title' attribute."));
$properties['width'] = DataDefinition::create('integer')
->setLabel(t('The width of the image in pixels.'));
->setLabel(t('Width'))
->setDescription(t('The width of the image in pixels.'));
$properties['height'] = DataDefinition::create('integer')
->setLabel(t('The height of the image in pixels.'));
->setLabel(t('Height'))
->setDescription(t('The height of the image in pixels.'));
return $properties;
}
......
......@@ -23,14 +23,14 @@ abstract class TextItemBase extends FieldItemBase {
*/
public static function propertyDefinitions(FieldStorageDefinitionInterface $field_definition) {
$properties['value'] = DataDefinition::create('string')
->setLabel(t('Text value'));
->setLabel(t('Text'));
$properties['format'] = DataDefinition::create('filter_format')
->setLabel(t('Text format'));
$properties['processed'] = DataDefinition::create('string')
->setLabel(t('Processed text'))
->setDescription(t('The text value with the text format applied.'))
->setDescription(t('The text with the text format applied.'))
->setComputed(TRUE)
->setClass('\Drupal\text\TextProcessed')
->setSetting('text source', 'value');
......
......@@ -40,11 +40,11 @@ public static function propertyDefinitions(FieldStorageDefinitionInterface $fiel
$properties = parent::propertyDefinitions($field_definition);
$properties['summary'] = DataDefinition::create('string')
->setLabel(t('Summary text value'));
->setLabel(t('Summary'));
$properties['summary_processed'] = DataDefinition::create('string')
->setLabel(t('Processed summary text'))
->setDescription(t('The summary text value with the text format applied.'))
->setLabel(t('Processed summary'))
->setDescription(t('The summary text with the text format applied.'))
->setComputed(TRUE)
->setClass('\Drupal\text\TextProcessed')
->setSetting('text source', 'summary');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment