class TestHtmlSource

Test source plugin implementation.

Plugin annotation


@SourcePlugin(
  id = "test_html_source",
  label = @Translation("Test HTML source"),
  description = @Translation("HTML source for testing purposes.")
)

Hierarchy

Expanded class hierarchy of TestHtmlSource

File

tmgmt_test/src/Plugin/tmgmt/Source/TestHtmlSource.php, line 16

Namespace

Drupal\tmgmt_test\Plugin\tmgmt\Source
View source
class TestHtmlSource extends TestSource {

  /**
   * {@inheritdoc}
   */
  public function getData(JobItemInterface $job_item) {
    return array(
      'dummy' => array(
        'deep_nesting' => array(
          '#text' => file_get_contents(\Drupal::service('extension.list.module')
            ->getPath('tmgmt') . '/tests/testing_html/sample.html'),
          '#label' => 'Label for job item with type ' . $job_item
            ->getItemType() . ' and id ' . $job_item
            ->getItemId() . '.',
        ),
      ),
    );
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SourcePluginBase::getItemTypeLabel public function Returns the label of a source item type. Overrides SourcePluginInterface::getItemTypeLabel 2
SourcePluginBase::getItemTypes public function Returns an array of translatable source item types. Overrides SourcePluginInterface::getItemTypes 3
SourcePluginBase::getType public function Returns the type of a job item. Overrides SourcePluginInterface::getType 3
TestHtmlSource::getData public function Returns an array with the data structured for translation. Overrides TestSource::getData
TestSource::getExistingLangCodes public function Gets existing translation language codes of the job item source. Overrides SourcePluginBase::getExistingLangCodes
TestSource::getLabel public function Return a title for this job item. Overrides SourcePluginBase::getLabel
TestSource::getSourceLangCode public function Gets language code of the job item source. Overrides SourcePluginInterface::getSourceLangCode
TestSource::getUrl public function Returns the Uri for this job item. Overrides SourcePluginBase::getUrl
TestSource::replacePlaceholders protected function Will replace placeholders in the #text offsets.
TestSource::saveTranslation public function Saves a translation. Overrides SourcePluginInterface::saveTranslation