You are here

protected function FacebookPostCollector::extractFacebookFeedData in Social Feed 8

Extract information from the Facebook feed.

Parameters

string $post_types: The type of posts to extract.

array $data: An array of data to extract information from.

Return value

array An array of posts.

1 call to FacebookPostCollector::extractFacebookFeedData()
FacebookPostCollector::getPosts in src/Services/FacebookPostCollector.php
Fetch Facebook posts from a given feed.

File

src/Services/FacebookPostCollector.php, line 150

Class

FacebookPostCollector
Class FacebookPostCollector.

Namespace

Drupal\socialfeed\Services

Code

protected function extractFacebookFeedData($post_types, array $data) {
  $posts = array_map(function ($post) {
    return $post;
  }, $data);

  // Filtering needed.
  if (TRUE == is_string($post_types)) {
    $posts = array_filter($posts, function ($post) use ($post_types) {
      return $post['status_type'] === $post_types;
    });
    return $posts;
  }
  return $posts;
}