You are here

public static function IconsetBase::explodeStyle in Social Media Links Block and Field 8.2

Explode the styles.

Parameters

string $style: The styles.

bool $key: If TRUE: Only the given key is returned.

Return value

string|array The array with the styles or a string if a $key was given.

3 calls to IconsetBase::explodeStyle()
SocialMediaLinksBlock::blockForm in src/Plugin/Block/SocialMediaLinksBlock.php
SocialMediaLinksBlock::build in src/Plugin/Block/SocialMediaLinksBlock.php
Builds and returns the renderable array for this block plugin.
SocialMediaLinksFieldDefaultFormatter::viewElements in modules/social_media_links_field/src/Plugin/Field/FieldFormatter/SocialMediaLinksFieldDefaultFormatter.php
Builds a renderable array for a field value.

File

src/IconsetBase.php, line 140

Class

IconsetBase
Base class for iconset.

Namespace

Drupal\social_media_links

Code

public static function explodeStyle($style, $key = FALSE) {
  $exploded = explode(':', $style);
  if ($key) {
    return $exploded[$key];
  }
  return [
    'iconset' => isset($exploded[0]) ? $exploded[0] : '',
    'style' => isset($exploded[1]) ? $exploded[1] : '',
  ];
}