You are here

function simplenews_newsletter_get_all in Simplenews 7.2

Same name and namespace in other branches
  1. 8.2 simplenews.module \simplenews_newsletter_get_all()
  2. 8 simplenews.module \simplenews_newsletter_get_all()
  3. 3.x simplenews.module \simplenews_newsletter_get_all()

Loads all visible newsletters.

Does not include newsletters with the opt-out/opt-in setting set to hidden.

Return value

array All newsletter entities.

Related topics

13 calls to simplenews_newsletter_get_all()
SimpleNewsAdministrationTestCase::testNewsletterSettings in tests/simplenews.test
Test various combinations of newsletter settings.
SimpleNewsAdministrationTestCase::testSubscriptionManagement in tests/simplenews.test
Test newsletter subscription management.
SimplenewsSubscribeTestCase::testSubscribeMultiple in tests/simplenews.test
Subscribe to multiple newsletters at the same time.
SimplenewsTestCase::getRandomNewsletter in tests/simplenews.test
Select randomly one of the available newsletters.
simplenews_form_user_register_form_alter in ./simplenews.module
Implements hook_form_FORM_ID_alter().

... See full list

File

./simplenews.module, line 2061
Simplenews node handling, sent email, newsletter block and general hooks

Code

function simplenews_newsletter_get_all() {
  $query = new EntityFieldQuery();
  $result = $query
    ->entityCondition('entity_type', 'simplenews_newsletter')
    ->propertyOrderBy('weight')
    ->execute();
  return isset($result['simplenews_newsletter']) ? simplenews_newsletter_load_multiple(array_keys($result['simplenews_newsletter'])) : NULL;
}