From 8acd554231b68cd63dcbb5b56d2478aaca8d9677 Mon Sep 17 00:00:00 2001 From: Dac Chartrand Date: Wed, 6 Sep 2017 11:49:36 -0400 Subject: [PATCH] The custom notice should override the auto all rights reserved on webbook as it does on export formats. (#38) --- functions.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/functions.php b/functions.php index c752df0f9..7041a0f9a 100644 --- a/functions.php +++ b/functions.php @@ -265,10 +265,29 @@ function pressbooks_comment( $comment, $args, $depth ) { */ function pressbooks_copyright_license() { $metadata = \Pressbooks\Book::getBookInformation(); - $html = _do_license( $metadata ); + + if ( empty( $metadata['pb_book_license'] ) ) { + $all_rights_reserved = true; + } elseif ( $metadata['pb_book_license'] === 'all-rights-reserved' ) { + $all_rights_reserved = true; + } else { + $all_rights_reserved = false; + } if ( ! empty( $metadata['pb_custom_copyright'] ) ) { + $has_custom_copyright = true; + } else { + $has_custom_copyright = false; + } + + // Custom Copyright must override All Rights Reserved + $html = ''; + if ( ! $has_custom_copyright || ( $has_custom_copyright && ! $all_rights_reserved ) ) { + $html .= _do_license( $metadata ); + } + if ( $has_custom_copyright ) { $html .= '
' . $metadata['pb_custom_copyright'] . '
'; } + return $html; }