You are here

class EventAnEnrollManager in Open Social 8.7

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollManager.php \Drupal\social_event_an_enroll\EventAnEnrollManager
  2. 8.5 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollManager.php \Drupal\social_event_an_enroll\EventAnEnrollManager
  3. 8.6 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollManager.php \Drupal\social_event_an_enroll\EventAnEnrollManager
  4. 8.8 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollManager.php \Drupal\social_event_an_enroll\EventAnEnrollManager
  5. 10.3.x modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollManager.php \Drupal\social_event_an_enroll\EventAnEnrollManager
  6. 10.0.x modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollManager.php \Drupal\social_event_an_enroll\EventAnEnrollManager
  7. 10.1.x modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollManager.php \Drupal\social_event_an_enroll\EventAnEnrollManager
  8. 10.2.x modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollManager.php \Drupal\social_event_an_enroll\EventAnEnrollManager

Class EventAnEnrollManager.

Hierarchy

Expanded class hierarchy of EventAnEnrollManager

4 files declare their use of EventAnEnrollManager
EnrolmentUserDisplayName.php in modules/social_features/social_event/modules/social_event_an_enroll_enrolments_export/src/Plugin/UserExportPlugin/EnrolmentUserDisplayName.php
ExportAllEnrolments.php in modules/social_features/social_event/modules/social_event_an_enroll_enrolments_export/src/Plugin/Action/ExportAllEnrolments.php
SocialEventAnEnrollSendEmail.php in modules/social_features/social_event/modules/social_event_an_enroll/src/Plugin/Action/SocialEventAnEnrollSendEmail.php
SocialEventAnEnrollViewsBulkOperationsBulkForm.php in modules/social_features/social_event/modules/social_event_an_enroll/src/Plugin/views/field/SocialEventAnEnrollViewsBulkOperationsBulkForm.php
1 string reference to 'EventAnEnrollManager'
social_event_an_enroll.services.yml in modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.services.yml
modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.services.yml
1 service uses EventAnEnrollManager
social_event_an_enroll.manager in modules/social_features/social_event/modules/social_event_an_enroll/social_event_an_enroll.services.yml
\Drupal\social_event_an_enroll\EventAnEnrollManager

File

modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollManager.php, line 11

Namespace

Drupal\social_event_an_enroll
View source
class EventAnEnrollManager {
  use StringTranslationTrait;

  /**
   * Returns guest name.
   *
   * @param \Drupal\social_event\EventEnrollmentInterface $entity
   *   The event enrollment.
   * @param bool $email
   *   TRUE if can show E-mail address when first and last names is not set.
   *
   * @return string
   *   Full name or E-mail address.
   */
  public function getGuestName(EventEnrollmentInterface $entity, $email = TRUE) {
    $parts = [];

    // If user doesn't have access to see the first/last/email value.
    // Lets return guest.
    if (!social_event_manager_or_organizer()) {
      return $this
        ->t('Guest');
    }
    if (!$entity->field_first_name
      ->isEmpty()) {
      $parts[] = $entity->field_first_name->value;
    }
    if (!$entity->field_last_name
      ->isEmpty()) {
      $parts[] = $entity->field_last_name->value;
    }
    if (!$parts && $email) {
      $parts[] = $entity->field_email->value;
    }
    return implode(' ', $parts);
  }

  /**
   * Check if enrollment user is guest.
   *
   * @param \Drupal\social_event\EventEnrollmentInterface $entity
   *   The event enrollment.
   *
   * @return bool
   *   TRUE if it is guest.
   */
  public function isGuest(EventEnrollmentInterface $entity) {
    return !$entity->field_account->target_id;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EventAnEnrollManager::getGuestName public function Returns guest name.
EventAnEnrollManager::isGuest public function Check if enrollment user is guest.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.