function course_book_count in Course 8.2
Same name and namespace in other branches
- 8.3 modules/course_book/course_book.module \course_book_count()
- 6 modules/course_book/course_book.module \course_book_count()
- 7.2 modules/course_book/course_book.module \course_book_count()
- 7 modules/course_book/course_book.module \course_book_count()
- 3.x modules/course_book/course_book.module \course_book_count()
Counts the number of book pages that are accessible to the current user.
Parameters
int $bid: A book ID.
array $exclude: (Optional) An array of node IDs. Any link whose ID is in this array will be excluded (along with its children).
Return value
int The number of accessible pages in a book.
2 calls to course_book_count()
- CourseObjectBook::grade in modules/
course_book/ src/ Plugin/ course/ CourseObject/ CourseObjectBook.php - Grade (track) the book based on the fulfillment data.
- course_book_override_outline_list_item in modules/
course_book/ course_book.module - Overrides a course outline list item.
File
- modules/
course_book/ course_book.module, line 132
Code
function course_book_count($bid, $exclude = array()) {
/* @var $book_manager Drupal\book\BookManager */
$book_manager = \Drupal::service('book.manager');
$toc = $book_manager
->getTableOfContents($bid, \Drupal::config('course_book.settings')
->get('depth', 100), $exclude);
$count = count($toc);
return $count;
}