You are here

public function SocialPostListBuilder::getDefaultOperations in Social Post 3.x

Same name and namespace in other branches
  1. 8.2 src/Entity/Controller/SocialPostListBuilder.php \Drupal\social_post\Entity\Controller\SocialPostListBuilder::getDefaultOperations()

Parameters

\Drupal\social_post\Entity\SocialPost|Drupal\Core\Entity\EntityTypeInterface $entity: The Social Post entity to process.

Overrides EntityListBuilder::getDefaultOperations

File

src/Entity/Controller/SocialPostListBuilder.php, line 133

Class

SocialPostListBuilder
Defines a class to build a listing of Social Post Entities.

Namespace

Drupal\social_post\Entity\Controller

Code

public function getDefaultOperations(EntityInterface $entity) {
  $provider = $entity
    ->getPluginId();
  if ($provider == 'social_post_' . $this->provider) {
    $operations = parent::getDefaultOperations($entity);
    $operations['delete'] = [
      'title' => $this
        ->t('Delete'),
      'url' => Url::fromRoute('entity.social_post.delete_form', [
        'provider' => $this->provider,
        'social_post' => $entity
          ->getId(),
        'user' => FALSE,
      ]),
    ];
    return $operations;
  }
  return [];
}