function simplenews_issue_newsletter_id in Simplenews 7.2
Gets or sets the newsletter for an issue.
Parameters
$node: The issue to get or set the status.
$value: (Optional) The newsletter id to be set or NULL to retrieve the current value.
Return value
The newsletter id or 0 if not set.
Related topics
6 calls to simplenews_issue_newsletter_id()
- SimplenewsSendTestCase::testProgrammaticNewsletter in tests/
simplenews.test - Creates and sends a node using the API.
- SimplenewsSendTestCase::testUpdateNewsletter in tests/
simplenews.test - SimplenewsSourceEntity::__construct in includes/
simplenews.source.inc - Implements SimplenewsSourceEntityInterface::_construct();
- SimpleNewsUpgradePathTestCase::assertUpgradePath in tests/
simplenews.test - simplenews_add_node_to_spool in includes/
simplenews.mail.inc - Add the newsletter node to the mail spool.
File
- ./
simplenews.module, line 2729 - Simplenews node handling, sent email, newsletter block and general hooks
Code
function simplenews_issue_newsletter_id($node, $value = NULL) {
$field = variable_get('simplenews_newsletter_field', 'simplenews_newsletter');
if ($value) {
return $node->{$field} = array(
LANGUAGE_NONE => array(
array(
'target_id' => $value,
),
),
);
}
elseif ($newsletter_id = field_get_items('node', $node, $field)) {
return $newsletter_id[0]['target_id'];
}
return 0;
}