You are here

protected function SocialSharingBlock::sortSocialMedias in Social media share 8

TODO describe what this does and what $element is.

1 call to SocialSharingBlock::sortSocialMedias()
SocialSharingBlock::build in src/Plugin/Block/SocialSharingBlock.php
Builds and returns the renderable array for this block plugin.

File

src/Plugin/Block/SocialSharingBlock.php, line 156

Class

SocialSharingBlock
Provides a 'SocialSharingBlock' block.

Namespace

Drupal\social_media\Plugin\Block

Code

protected function sortSocialMedias(&$element) {
  $weight = [];
  foreach ($element as $key => $row) {
    $weight[$key] = $row['weight'];
  }
  array_multisort($weight, SORT_ASC, $element);
  return $element;
}