social_page.module in Open Social 8.5
Same filename and directory in other branches
- 8.9 modules/social_features/social_page/social_page.module
- 8 modules/social_features/social_page/social_page.module
- 8.2 modules/social_features/social_page/social_page.module
- 8.3 modules/social_features/social_page/social_page.module
- 8.4 modules/social_features/social_page/social_page.module
- 8.6 modules/social_features/social_page/social_page.module
- 8.7 modules/social_features/social_page/social_page.module
- 8.8 modules/social_features/social_page/social_page.module
- 10.3.x modules/social_features/social_page/social_page.module
- 10.0.x modules/social_features/social_page/social_page.module
- 10.1.x modules/social_features/social_page/social_page.module
- 10.2.x modules/social_features/social_page/social_page.module
Contains social_page.module..
File
modules/social_features/social_page/social_page.moduleView source
<?php
/**
* @file
* Contains social_page.module..
*/
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Url;
use Drupal\node\NodeInterface;
/**
* Implements hook_help().
*/
function social_page_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the social_page module.
case 'help.page.social_page':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('Use basic pages for your static content, such as an about page.') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_node_links_alter().
*/
function social_page_node_links_alter(array &$links, NodeInterface $entity, array &$context) {
// Remove the add new comment link.
unset($links['comment__field_page_comments']['#links']['comment-add']);
}
/**
* Implements hook_social_user_account_header_create_links().
*
* Adds the "Create Page" link to the content creation menu.
*/
function social_page_social_user_account_header_create_links($context) {
return [
'add_page' => [
'#type' => 'link',
'#attributes' => [
'title' => new TranslatableMarkup('Create New Page'),
],
'#title' => new TranslatableMarkup('New Page'),
'#weight' => 300,
] + Url::fromRoute('node.add', [
'node_type' => 'page',
])
->toRenderArray(),
];
}
Functions
Name![]() |
Description |
---|---|
social_page_help | Implements hook_help(). |
social_page_node_links_alter | Implements hook_node_links_alter(). |
social_page_social_user_account_header_create_links | Implements hook_social_user_account_header_create_links(). |