Commit d9b94048 authored by ROBERT PATRICK CAREY III's avatar ROBERT PATRICK CAREY III 🗿

Fix: Exception: in Drupal\book\BookExport->bookExport()

parent d8cf6bce
......@@ -45,6 +45,7 @@ function user_preferences_node_links_alter(array &$links, NodeInterface $node, a
$user = \Drupal::currentUser();
$is_admin = in_array('administrator', $user->getRoles());
$is_front = \Drupal::service('path.matcher')->isFrontPage();
$is_book = isset($node->book['bid']);
if(!$is_admin){
$can_add_child_page = in_array('Add content and child pages to books and manage their hierarchies', user_role_permissions($user->getRoles()));
......@@ -122,7 +123,7 @@ function user_preferences_node_links_alter(array &$links, NodeInterface $node, a
'aria-label' => 'Toggle fullscreen',
]
];
if($is_admin || $can_add_child_page){
if(($is_admin || $can_add_child_page) && $is_book){
$link['addPage'] = [
'title' => t('
<span class="fa-layers">
......@@ -155,7 +156,7 @@ function user_preferences_node_links_alter(array &$links, NodeInterface $node, a
];
*/
}
if(!$is_front){
if(!$is_front && $is_book){
$link['printerFriendly'] = [
'title' => t('<i class="fal fa-print">&nbsp;</i>'),
'url' => Url::fromUri('internal:/book/export/html/'.$nid),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment