You are here

protected function SocialSharingBlock::socialMediaConvertAttributes in Social media share 8

TODO describe what this does and what $variables is.

1 call to SocialSharingBlock::socialMediaConvertAttributes()
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 168

Class

SocialSharingBlock
Provides a 'SocialSharingBlock' block.

Namespace

Drupal\social_media\Plugin\Block

Code

protected function socialMediaConvertAttributes($variables) {
  $variable = explode("\n", $variables);
  $attributes = [];
  if (count($variable)) {
    foreach ($variable as $each) {
      if ($each === '') {
        continue;
      }
      $var = explode("|", $each);
      $value = str_replace([
        "\r\n",
        "\n",
        "\r",
      ], "", $var[1]);
      $attributes[$var[0]] = new Attribute([
        $var[0] => $value,
      ]);
    }
  }
  return $attributes;
}