You are here

class TMGMTJobMetadataController in Translation Management Tool 7

Metadata controller for the job entity.

Hierarchy

Expanded class hierarchy of TMGMTJobMetadataController

1 string reference to 'TMGMTJobMetadataController'
tmgmt_entity_info in ./tmgmt.module
Implements hook_entity_info().

File

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

View source
class TMGMTJobMetadataController extends EntityDefaultMetadataController {

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityDefaultMetadataController::$type protected property
EntityDefaultMetadataController::bundleOptionsList public static function A options list callback returning all bundles for an entity type.
EntityDefaultMetadataController::convertSchema protected function Return a set of properties for an entity based on the schema definition
EntityDefaultMetadataController::__construct public function
TMGMTJobMetadataController::entityPropertyInfo public function Overrides EntityDefaultMetadataController::entityPropertyInfo