You are here

private function TwitterWidget::createUrl in Twitter Embed 8

Returns a Twitter Url depending on the configuration.

Parameters

array $configuration: List of selected configuration.

Return value

\Drupal\Core\Url The Twitter Url.

1 call to TwitterWidget::createUrl()
TwitterWidget::getWidget in src/TwitterWidget.php
Returns a Twitter widget depending on the configuration.

File

src/TwitterWidget.php, line 80

Class

TwitterWidget
Class TwitterWidget.

Namespace

Drupal\twitter_embed

Code

private function createUrl(array $configuration) {
  $uri = 'https://twitter.com/' . $configuration['username'];

  // @todo refactor 'display_style' used for Button instead of 'type'
  // @todo complete configuration
  switch ($configuration['type']) {
    case 'list':
      $uri .= '/lists/' . $configuration['type_value'];
      break;
    case 'collection':
      $uri .= '/timelines/' . $configuration['type_value'];
      break;
    case 'likes':
      $uri .= '/likes';
      break;
  }
  return Url::fromUri($uri);
}