function simplenews_newsletter_get_visible in Simplenews 7.2
Same name and namespace in other branches
- 8.2 simplenews.module \simplenews_newsletter_get_visible()
- 8 simplenews.module \simplenews_newsletter_get_visible()
- 3.x simplenews.module \simplenews_newsletter_get_visible()
Loads all visible newsletters.
Does not include newsletters with the opt-out/opt-in setting set to hidden. It is possible to apply additional conditions.
Parameters
$conditions Aditional contitions.:
Return value
array Filtered newsletter entities.
Related topics
7 calls to simplenews_newsletter_get_visible()
- simplenews_block_info in ./
simplenews.module - Implements hook_block_info().
- simplenews_block_view in ./
simplenews.module - Implements hook_block_view().
- simplenews_subscriptions_account_form in includes/
simplenews.subscription.inc - FAPI ACCOUNT subscription form.
- simplenews_subscriptions_admin_form in includes/
simplenews.subscription.inc - FAPI ADMIN subscription form.
- simplenews_subscriptions_multi_block_form in includes/
simplenews.subscription.inc - FAPI MULTI BLOCK subscription form.
File
- ./
simplenews.module, line 2039 - Simplenews node handling, sent email, newsletter block and general hooks
Code
function simplenews_newsletter_get_visible($conditions = array()) {
$query = new EntityFieldQuery();
$query
->entityCondition('entity_type', 'simplenews_newsletter')
->propertyCondition('opt_inout', SIMPLENEWS_OPT_INOUT_HIDDEN, '<>')
->propertyOrderBy('weight');
foreach ($conditions as $key => $value) {
$query
->propertyCondition($key, $value);
}
$result = $query
->execute();
return isset($result['simplenews_newsletter']) ? simplenews_newsletter_load_multiple(array_keys($result['simplenews_newsletter'])) : NULL;
}