You are here

public function ContactEmailStorage::loadValid in Contact Emails 8

Loads the valid contact emails for the given contact form.

Parameters

string $contact_form_id: The contact form ID to load emails for.

bool $enabled_only: Whether or not to filter by enabled emails only.

Return value

\Drupal\contact_emails\Entity\ContactEmailInterface[] The valid contact emails.

Overrides ContactEmailStorageInterface::loadValid

1 call to ContactEmailStorage::loadValid()
ContactEmailStorage::hasContactEmails in src/ContactEmailStorage.php
Checks if there are contact emails for the provided form.

File

src/ContactEmailStorage.php, line 22

Class

ContactEmailStorage
Defines the contact email storage.

Namespace

Drupal\contact_emails

Code

public function loadValid($contact_form_id, $enabled_only = FALSE) {
  $query = $this
    ->getQuery();
  $query
    ->condition('contact_form', $contact_form_id);
  if ($enabled_only) {
    $query
      ->condition('status', TRUE);
  }
  $result = $query
    ->execute();
  if (!empty($result)) {
    return $this
      ->loadMultiple($result);
  }
  return FALSE;
}