You are here

function simplenews_get_content_types in Simplenews 8

Same name and namespace in other branches
  1. 8.2 simplenews.module \simplenews_get_content_types()
  2. 7.2 simplenews.module \simplenews_get_content_types()
  3. 7 simplenews.module \simplenews_get_content_types()
  4. 3.x simplenews.module \simplenews_get_content_types()

Get all node types supported by Simplenews.

Return value

Array of node-types which can be used a simplenews newsletter issue.

Related topics

3 calls to simplenews_get_content_types()
AddSimplenewsIssueActionLinks::getDerivativeDefinitions in src/Plugin/Derivative/AddSimplenewsIssueActionLinks.php
Gets the definition of all derivatives of a base plugin.
simplenews_check_node_types in ./simplenews.module
Check if content type(s) is enabled for use as Simplenews newsletter.
simplenews_form_node_form_alter in ./simplenews.module
Implements hook_form_alter().
1 string reference to 'simplenews_get_content_types'
simplenews_node_type_delete in ./simplenews.module
Implements hook_node_type_delete().

File

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

Code

function simplenews_get_content_types() {
  $simplenews_types =& drupal_static(__FUNCTION__, array());
  if (!$simplenews_types) {
    $field_map = \Drupal::service('entity_field.manager')
      ->getFieldMapByFieldType('simplenews_issue');
    $simplenews_types = isset($field_map['node']['simplenews_issue']) ? $field_map['node']['simplenews_issue']['bundles'] : array();
  }
  return $simplenews_types;
}