You are here

public function ContentInMyGroupActivityContext::isValidEntity in Open Social 10.2.x

Same name and namespace in other branches
  1. 8.9 modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php \Drupal\activity_basics\Plugin\ActivityContext\ContentInMyGroupActivityContext::isValidEntity()
  2. 8 modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php \Drupal\activity_basics\Plugin\ActivityContext\ContentInMyGroupActivityContext::isValidEntity()
  3. 8.2 modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php \Drupal\activity_basics\Plugin\ActivityContext\ContentInMyGroupActivityContext::isValidEntity()
  4. 8.3 modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php \Drupal\activity_basics\Plugin\ActivityContext\ContentInMyGroupActivityContext::isValidEntity()
  5. 8.4 modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php \Drupal\activity_basics\Plugin\ActivityContext\ContentInMyGroupActivityContext::isValidEntity()
  6. 8.5 modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php \Drupal\activity_basics\Plugin\ActivityContext\ContentInMyGroupActivityContext::isValidEntity()
  7. 8.6 modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php \Drupal\activity_basics\Plugin\ActivityContext\ContentInMyGroupActivityContext::isValidEntity()
  8. 8.7 modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php \Drupal\activity_basics\Plugin\ActivityContext\ContentInMyGroupActivityContext::isValidEntity()
  9. 8.8 modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php \Drupal\activity_basics\Plugin\ActivityContext\ContentInMyGroupActivityContext::isValidEntity()
  10. 10.3.x modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php \Drupal\activity_basics\Plugin\ActivityContext\ContentInMyGroupActivityContext::isValidEntity()
  11. 10.0.x modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php \Drupal\activity_basics\Plugin\ActivityContext\ContentInMyGroupActivityContext::isValidEntity()
  12. 10.1.x modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php \Drupal\activity_basics\Plugin\ActivityContext\ContentInMyGroupActivityContext::isValidEntity()

Determines if the entity is valid for this context.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity object.

Return value

bool TRUE if it's valid entity.

Overrides ActivityContextBase::isValidEntity

File

modules/custom/activity_basics/src/Plugin/ActivityContext/ContentInMyGroupActivityContext.php, line 115

Class

ContentInMyGroupActivityContext
Provides a 'ContentInMyGroupActivityContext' activity context.

Namespace

Drupal\activity_basics\Plugin\ActivityContext

Code

public function isValidEntity(EntityInterface $entity) {
  switch ($entity
    ->getEntityTypeId()) {
    case 'group_content':
      return TRUE;
    case 'post':
      return !$entity->field_recipient_group
        ->isEmpty();
    default:
      return FALSE;
  }
}