You are here

function subscriptions_ui_field_extra_fields in Subscriptions 2.0.x

Same name and namespace in other branches
  1. 7 subscriptions_ui.module \subscriptions_ui_field_extra_fields()

Implements hook_field_extra_fields().

Enables CCK (admin/content/types/CONTENT_TYPE/fields) to configure the position of the Subscribe fieldset within the node.

Return value

array

File

subscriptions_ui/subscriptions_ui.module, line 549
Provides a user interface for Subscriptions.

Code

function subscriptions_ui_field_extra_fields() {
  $extra = [];
  if (variable_get('subscriptions_form_in_block', 0)) {
    $types = db_query("SELECT type FROM {block_node_type} WHERE module = :module AND delta = :delta", [
      ':module' => 'subscriptions_ui',
      ':delta' => 0,
    ])
      ->fetchCol();
    if (empty($types)) {
      $types = array_keys(node_type_get_types());
    }
    foreach ($types as $type) {
      $extra['node'][$type]['display']['subscriptions_ui'] = [
        'label' => t('Subscribe'),
        'description' => t('!Subscriptions_UI module form.', [
          '!Subscriptions_UI' => 'Subscriptions UI',
        ]),
        'weight' => 100,
      ];
    }
  }
  return $extra;
}