You are here

public function TweetFeedCommands::import in Tweet Feed 4.x

Same name and namespace in other branches
  1. 8.3 src/Commands/TweetFeedCommands.php \Drupal\tweet_feed\Commands\TweetFeedCommands::import()

Import the latest batch of tweets.

@usage tweet_feed:import feed1 Import the feeds as configured in machine name feed1.

@command tweet_feed:import @aliases tfi

Parameters

$feed: The machine name of the feed to be imported

File

src/Commands/TweetFeedCommands.php, line 60

Class

TweetFeedCommands
A Drush commandfile.

Namespace

Drupal\tweet_feed\Commands

Code

public function import($feed) {

  // Sanity check to make sure the feed exists.
  $feed_config = \Drupal::service('config.factory')
    ->get('tweet_feed.twitter_feeds');
  $feeds = $feed_config
    ->get('feeds');
  if (!empty($feeds[$feed])) {
    $tf = new TweetFeed();
    $tf
      ->pullDataFromFeed($feed);
    return TRUE;
  }
}