Created
June 24, 2018 12:12
-
-
Save h1ldebrand/d87d91d003b1819ad1a86caca0889d53 to your computer and use it in GitHub Desktop.
получить значение поля в блоке и передать его в js
This file contains hidden or 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
function naturetour_page_attachments_alter(array &$attachments){ | |
$uuid = \Drupal\block\Entity\Block::load('usefull')->getPlugin()->getDerivativeId(); | |
$block_content = \Drupal::service('entity.repository')->loadEntityByUuid('block_content', $uuid); | |
if ($block_content) { | |
$field_value = $block_content->field_something_item->value; | |
$attachments['#attached']['drupalSettings']['naturetour']['custom']['something_item'] = $field_value; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment