Created
June 11, 2019 20:54
-
-
Save vadym1930/c2c8903022763a26aec6147812e4288b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_preprocess_HOOK(). | |
*/ | |
function THEME_preprocess_paragraph__button_icon(&$variables) { | |
$paragraph = $variables['elements']['#paragraph']; | |
$icon = $paragraph->get('field_icon_button')->getValue(); | |
if (!empty($icon)) { | |
$entity = \Drupal::entityTypeManager()->getStorage("media")->load($icon[0]['target_id']); | |
$variables['button_icon'] = $entity->field_media_svg->entity->getFileUri(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment