You are here

public function TMGMTJobMetadataController::entityPropertyInfo in Translation Management Tool 7

Overrides EntityDefaultMetadataController::entityPropertyInfo

File

includes/tmgmt.info.inc, line 17
Contains the metadata controller classes for the Translation Management Tool entities.

Class

TMGMTJobMetadataController
Metadata controller for the job entity.

Code

public function entityPropertyInfo() {
  $info = parent::entityPropertyInfo();
  $info = _tmgmt_override_property_description($info, $this->type);
  $properties =& $info[$this->type]['properties'];

  // Make the created and changed property appear as date.
  $properties['changed']['type'] = $properties['created']['type'] = 'date';

  // Use the defined entity label callback instead of the custom label directly.
  $properties['label']['getter callback'] = 'entity_class_label';

  // Allow to change the properties.
  foreach (array(
    'target_language',
    'source_language',
    'translator',
  ) as $property) {
    $properties[$property]['setter callback'] = 'entity_property_verbatim_set';
  }

  // Add the options list for the available languages.
  $properties['target_language']['options list'] = $properties['source_language']['options list'] = 'entity_metadata_language_list';

  // Add the options list for the defined state constants.
  $properties['state']['options list'] = 'tmgmt_job_states';

  // Add the options list for all available translator plugins.
  $properties['translator']['type'] = 'tmgmt_translator';
  $properties['translator']['options list'] = 'tmgmt_translator_labels';

  // Link the author property to the corresponding user entity.
  $properties['author'] = array(
    'label' => t('Author'),
    'type' => 'user',
    'description' => t('The author of the translation job.'),
    'setter callback' => 'entity_property_verbatim_set',
    'setter permission' => 'administer tmgmt',
    'required' => TRUE,
    'schema field' => 'uid',
  );
  return $info;
}