Error message

  • Warning: count(): Parameter must be an array or an object that implements Countable in _api_make_match_member_link() (line 1230 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).
  • Warning: count(): Parameter must be an array or an object that implements Countable in _api_make_match_member_link() (line 1230 of /home/projects/api/www/sites/all/modules/api/api.formatting.inc).

public function TestSource::getData

Returns an array with the data structured for translation.

Parameters

\Drupal\tmgmt\JobItemInterface $job_item: The job item entity.

Overrides SourcePluginInterface::getData

See also

JobItem::getData()

1 method overrides TestSource::getData()
TestHtmlSource::getData in tmgmt_test/src/Plugin/tmgmt/Source/TestHtmlSource.php
Returns an array with the data structured for translation.

File

tmgmt_test/src/Plugin/tmgmt/Source/TestSource.php, line 57

Class

TestSource
Test source plugin implementation.

Namespace

Drupal\tmgmt_test\Plugin\tmgmt\Source

Code

public function getData(JobItemInterface $job_item) {

  // Allow tests to set custom source data.
  $source = \Drupal::state()
    ->get('tmgmt.test_source_data', array(
    'dummy' => array(
      'deep_nesting' => array(
        '#text' => 'Text for job item with type @type and id @id.',
        '#label' => 'Label for job item with type @type and id @id.',
        '#translate' => TRUE,
      ),
    ),
  ));
  $variables = array(
    '@type' => $job_item
      ->getItemType(),
    '@id' => $job_item
      ->getItemId(),
  );
  $this
    ->replacePlaceholders($source, $variables);
  return $source;
}