Hot answers tagged

1

It's hard to tell exactly what you're going for, but to elaborate on @kiamlaluno's comment, you'd want to do something like the following. First, update your updateDisplay() function to accept your $node's $build array as a parameter passed by reference. This allows you to make alterations to the variable inside your function that will be preserved outside ...


1

What you can do is first create nodes using the API data and create a table view. so that the views fields can be referenced to nodes and they can be updated. By this way you wont be needing any additional event handlers. To Create Nodes you can use the following snippet: use \Drupal\node\Entity\Node; $node = Node::create([ 'type' => '...


1

I'd recommend doing this by creating a new Field Formatter by extending the default EntityReferenceRevisionsEntityFormatter (or extending whichever formatter you're using to display the paragraphs). If you're not sure how to create a field formatter, review the Create a custom field formatter documentation on d.o. Specifically, you'll need to override the ...


1

The variable $user should probably be the parent entity of the field: $user = $items->getEntity(); Which then when used as cache dependency should solve the caching issue: $result->addCacheableDependency($user); BTW you find the current user already in $account. If your access check depends on it then don't add it as object but use this predefined ...


Only top voted, non community-wiki answers of a minimum length are eligible