You are here

public function SocialSimpleManager::getSortedNetworks in Social simple 2.0.x

Same name and namespace in other branches
  1. 8 src/SocialSimpleManager.php \Drupal\social_simple\SocialSimpleManager::getSortedNetworks()

Returns the sorted array of social network objects.

Return value

\Drupal\social_simple\SocialNetwork\SocialNetworkInterface[] An array of social network objects keyed by their id.

Overrides SocialSimpleManagerInterface::getSortedNetworks

1 call to SocialSimpleManager::getSortedNetworks()
SocialSimpleManager::getNetworks in src/SocialSimpleManager.php
Gets all the instantiated social networks.

File

src/SocialSimpleManager.php, line 74

Class

SocialSimpleManager
Provides a social network manager.

Namespace

Drupal\social_simple

Code

public function getSortedNetworks() {
  if (!isset($this->sortedNetworks)) {
    foreach ($this->networks as $network_id => $networks_by_priority) {
      krsort($this->networks[$network_id]);
      $network_services = reset($this->networks[$network_id]);
      $this->sortedNetworks[$network_id] = reset($network_services);
    }
  }
  return $this->sortedNetworks;
}