You are here

public function SocialAlbumEntityOperations::render in Open Social 10.1.x

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_album/src/Plugin/views/field/SocialAlbumEntityOperations.php \Drupal\social_album\Plugin\views\field\SocialAlbumEntityOperations::render()
  2. 10.0.x modules/social_features/social_album/src/Plugin/views/field/SocialAlbumEntityOperations.php \Drupal\social_album\Plugin\views\field\SocialAlbumEntityOperations::render()
  3. 10.2.x modules/social_features/social_album/src/Plugin/views/field/SocialAlbumEntityOperations.php \Drupal\social_album\Plugin\views\field\SocialAlbumEntityOperations::render()

Renders the field.

Parameters

\Drupal\views\ResultRow $values: The values retrieved from a single row of a view's query result.

Return value

string|\Drupal\Component\Render\MarkupInterface The rendered output. If the output is safe it will be wrapped in an object that implements MarkupInterface. If it is empty or unsafe it will be a string.

Overrides EntityOperations::render

File

modules/social_features/social_album/src/Plugin/views/field/SocialAlbumEntityOperations.php, line 22

Class

SocialAlbumEntityOperations
Renders all operations links for a post.

Namespace

Drupal\social_album\Plugin\views\field

Code

public function render(ResultRow $values) {
  foreach (get_object_vars($values) as $key => $value) {
    if (preg_match('/_delta$/', $key)) {
      break;
    }
  }
  $entity = $this
    ->getEntity($values);
  return [
    '#lazy_builder' => [
      [
        $this,
        'renderLinks',
      ],
      [
        $values->_entity
          ->id(),
        $entity
          ->id(),
        $entity->field_post_image
          ->get($value)->target_id,
      ],
    ],
  ];
}