You are here

lightning_media_twitter.module in Lightning Media 8

Support for tweets as media entities in Lightning.

File

modules/lightning_media_twitter/lightning_media_twitter.module
View source
<?php

/**
 * @file
 * Support for tweets as media entities in Lightning.
 */
use Drupal\lightning_core\OverrideHelper as Override;
use Drupal\lightning_media_twitter\Plugin\media\Source\Twitter;

/**
 * Implements hook_media_source_info_alter().
 */
function lightning_media_twitter_media_source_info_alter(array &$sources) {
  $sources['twitter']['input_match'] = [
    'constraint' => 'TweetEmbedCode',
    'field_types' => [
      'string',
      'string_long',
    ],
  ];
  $sources['twitter']['preview'] = TRUE;
  Override::pluginClass($sources['twitter'], Twitter::class);
}