social_book.module in Open Social 10.3.x
Same filename and directory in other branches
- 8.9 modules/social_features/social_book/social_book.module
- 8 modules/social_features/social_book/social_book.module
- 8.2 modules/social_features/social_book/social_book.module
- 8.3 modules/social_features/social_book/social_book.module
- 8.4 modules/social_features/social_book/social_book.module
- 8.5 modules/social_features/social_book/social_book.module
- 8.6 modules/social_features/social_book/social_book.module
- 8.7 modules/social_features/social_book/social_book.module
- 8.8 modules/social_features/social_book/social_book.module
- 10.0.x modules/social_features/social_book/social_book.module
- 10.1.x modules/social_features/social_book/social_book.module
- 10.2.x modules/social_features/social_book/social_book.module
The Social book module.
File
modules/social_features/social_book/social_book.moduleView source
<?php
/**
* @file
* The Social book module.
*/
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Url;
use Drupal\node\NodeInterface;
/**
* Implements hook_node_links_alter().
*/
function social_book_node_links_alter(array &$links, NodeInterface $entity, array &$context) {
// Remove the printer-friendly version link.
unset($links['book']['#links']['book_printer']);
unset($links['book']['#links']['book_add_child']);
}
/**
* Implements hook_menu_local_tasks_alter().
*/
function social_book_menu_local_tasks_alter(&$data, $route_name) {
// Remove the outline from ALL pages.
if (isset($data['tabs'][0]['entity.node.book_outline_form'])) {
unset($data['tabs'][0]['entity.node.book_outline_form']);
}
}
/**
* Implements hook_social_user_account_header_create_links().
*
* Adds the "Create Book" link to the content creation menu if the user is
* allowed to create new books.
*/
function social_book_social_user_account_header_create_links($context) {
return [
'add_book' => [
'#type' => 'link',
'#attributes' => [
'title' => new TranslatableMarkup('Create New Book Page'),
],
'#title' => new TranslatableMarkup('New Book Page'),
] + Url::fromRoute('node.add', [
'node_type' => 'book',
])
->toRenderArray(),
];
}
/**
* Implements hook_social_core_compatible_content_forms_alter().
*/
function social_book_social_core_compatible_content_forms_alter(&$compatible_content_type_forms) {
$compatible_content_type_forms[] = 'node_book_form';
$compatible_content_type_forms[] = 'node_book_edit_form';
}
Functions
Name | Description |
---|---|
social_book_menu_local_tasks_alter | Implements hook_menu_local_tasks_alter(). |
social_book_node_links_alter | Implements hook_node_links_alter(). |
social_book_social_core_compatible_content_forms_alter | Implements hook_social_core_compatible_content_forms_alter(). |
social_book_social_user_account_header_create_links | Implements hook_social_user_account_header_create_links(). |