You are here

function subscriptions_ui_can_subscribe in Subscriptions 2.0.x

Same name and namespace in other branches
  1. 5.2 subscriptions_ui.module \subscriptions_ui_can_subscribe()
  2. 6 subscriptions_ui.module \subscriptions_ui_can_subscribe()
  3. 7 subscriptions_ui.module \subscriptions_ui_can_subscribe()

Checks if any other module wants to provide the UI.

Parameters

\Drupal\node\NodeInterface $node: (optional) A node object. Defaults to NULL.

Return value

bool Returns TRUE if no other module will provide the UI, FALSE otherwise.

3 calls to subscriptions_ui_can_subscribe()
old_subscriptions_ui_node_view in subscriptions_ui/subscriptions_ui.module
Implements hook_node_view().
subscriptions_ui_block_view in subscriptions_ui/subscriptions_ui.module
Implements hook_block_view().
subscriptions_ui_node_view in subscriptions_ui/subscriptions_ui.module
Implements hook_ENTITY_TYPE_view().

File

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

Code

function subscriptions_ui_can_subscribe(NodeInterface $node = NULL) : bool {
  $user = \Drupal::currentUser();
  if (!$user
    ->isAuthenticated()) {
    return FALSE;
  }
  if (empty($node)) {
    return FALSE;
  }
  $permission = \Drupal::moduleHandler()
    ->invokeAll('subscriptions_ui_get_permission_to_handle', [
    $node,
  ]);
  $permission = array_filter($permission);
  if (!empty($permission)) {
    return FALSE;
  }
}