common.inc

Common functions that many Drupal modules will need to reference. The functions that are critical and need to be available even when serving a cached page are instead located in bootstrap.inc. File core/includes/common.inc Functions Name Description archiver_get_archiver Creates the appropriate archiver for the specified file. archiver_get_extensions Returns a string of supported archive extensions. base_path Returns the base URL path (i.e., directory) of the Drupal installati

comment_view

comment_view(CommentInterface $comment, $view_mode = 'full', $langcode = NULL) Generates an array for rendering a comment. Parameters \Drupal\comment\CommentInterface $comment: The comment object. string $view_mode: (optional) View mode; for instance, 'full', 'teaser', etc. Defaults to 'full'. string $langcode: (optional) A language code to use for rendering. Defaults to the global content language of the current request. Return value array An array as expected by drupal_render(). Deprecated

comment_user_predelete

comment_user_predelete($account) Implements hook_ENTITY_TYPE_predelete() for user entities. File core/modules/comment/comment.module, line 543 Enables users to comment on published content. Code function comment_user_predelete($account) { $entity_query = \Drupal::entityQuery('comment'); $entity_query->condition('uid', $account->id()); $cids = $entity_query->execute(); entity_delete_multiple('comment', $cids); }

comment_view_multiple

comment_view_multiple($comments, $view_mode = 'full', $langcode = NULL) Constructs render array from an array of loaded comments. Parameters \Drupal\comment\CommentInterface[] $comments: An array of comments as returned by entity_load_multiple(). string $view_mode: (optional) View mode; for instance, 'full', 'teaser', etc. Defaults to 'full'. string $langcode: (optional) A string indicating the language field values are to be shown in. If no language is provided the current content language is

comment_views_data_alter

comment_views_data_alter(&$data) Implements hook_views_data_alter(). File core/modules/comment/comment.views.inc, line 11 Provide views data for comment.module. Code function comment_views_data_alter(&$data) { // New comments are only supported for node table because it requires the // history table. $data['node']['new_comments'] = array( 'title' => t('New comments'), 'help' => t('The number of new comments on the node.'), 'field' => array( 'id' =>

comment_uri

comment_uri(CommentInterface $comment) Entity URI callback. File core/modules/comment/comment.module, line 87 Enables users to comment on published content. Code function comment_uri(CommentInterface $comment) { return new Url( 'entity.comment.canonical', array( 'comment' => $comment->id(), ), array('fragment' => 'comment-' . $comment->id()) ); }

comment_tokens

comment_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) Implements hook_tokens(). File core/modules/comment/comment.tokens.inc, line 123 Builds placeholder replacement tokens for comment-related data. Code function comment_tokens($type, $tokens, array $data, array $options, BubbleableMetadata $bubbleable_metadata) { $token_service = \Drupal::token(); $url_options = array('absolute' => TRUE); if (isset($options['langcode'])) { $url_opt

comment_user_cancel

comment_user_cancel($edit, $account, $method) Implements hook_user_cancel(). File core/modules/comment/comment.module, line 518 Enables users to comment on published content. Code function comment_user_cancel($edit, $account, $method) { switch ($method) { case 'user_cancel_block_unpublish': $comments = entity_load_multiple_by_properties('comment', array('uid' => $account->id())); foreach ($comments as $comment) { $comment->setPublished(CommentInterface::NOT_

comment_token_info

comment_token_info() Implements hook_token_info(). File core/modules/comment/comment.tokens.inc, line 17 Builds placeholder replacement tokens for comment-related data. Code function comment_token_info() { $type = array( 'name' => t('Comments'), 'description' => t('Tokens for comments posted on the site.'), 'needs-data' => 'comment', ); $tokens = []; // Provide a integration for each entity type except comment. foreach (\Drupal::entityTypeManager()->getDefin

comment_theme

comment_theme() Implements hook_theme(). File core/modules/comment/comment.module, line 126 Enables users to comment on published content. Code function comment_theme() { return array( 'comment' => array( 'render element' => 'elements', ), 'field__comment' => array( 'base hook' => 'field', ), ); }