You are here

public function SocialApiController::integrations in Social API 3.x

Same name and namespace in other branches
  1. 8.2 src/Controller/SocialApiController.php \Drupal\social_api\Controller\SocialApiController::integrations()
  2. 8 src/Controller/SocialApiController.php \Drupal\social_api\Controller\SocialApiController::integrations()

Render the list of plugins for a social network.

Parameters

string $type: Integration type: social_auth, social_post, or social_widgets.

Return value

array Render array listing the integrations.

File

src/Controller/SocialApiController.php, line 46

Class

SocialApiController
Renders integrations of social api.

Namespace

Drupal\social_api\Controller

Code

public function integrations($type) {
  $networks = $this->networkManager
    ->getDefinitions();
  $header = [
    $this
      ->t('Module'),
    $this
      ->t('Social Network'),
  ];
  $data = [];
  foreach ($networks as $network) {
    if ($network['type'] == $type) {
      $data[] = [
        $network['id'],
        $network['social_network'],
      ];
    }
  }
  return [
    '#theme' => 'table',
    '#header' => $header,
    '#rows' => $data,
    '#empty' => $this
      ->t('There are no social integrations enabled.'),
  ];
}