diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..14bc68c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/nbproject/private/
\ No newline at end of file
diff --git a/core/modules/book/book.module b/core/modules/book/book.module
index 1fe04c8..1390a3d 100644
--- a/core/modules/book/book.module
+++ b/core/modules/book/book.module
@@ -186,12 +186,7 @@
'type' => MENU_SUGGESTED_ITEM,
);
$items['book/export/%/%node'] = array(
- 'page callback' => 'book_export',
- 'page arguments' => array(2, 3),
- 'access callback' => 'book_export_access',
- 'access arguments' => array(3),
- 'type' => MENU_CALLBACK,
- 'file' => 'book.pages.inc',
+ 'route_name' => 'book_export',
);
$items['node/%node/outline'] = array(
'title' => 'Outline',
diff --git a/core/modules/book/book.pages.inc b/core/modules/book/book.pages.inc
index bc5ec53..a0e165c 100644
--- a/core/modules/book/book.pages.inc
+++ b/core/modules/book/book.pages.inc
@@ -6,83 +6,6 @@
*/
use Drupal\Core\Entity\EntityInterface;
-use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
-use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
-
-/**
- * Page callback: Generates representations of a book page and its children.
- *
- * The function delegates the generation of output to helper functions. The
- * function name is derived by prepending 'book_export_' to the given output
- * type. So, e.g., a type of 'html' results in a call to the function
- * book_export_html().
- *
- * @param $type
- * A string encoding the type of output requested. The following types are
- * currently supported in book module:
- * - html: Printer-friendly HTML.
- * Other types may be supported in contributed modules.
- * @param \Drupal\node\Plugin\Core\Entity\EntityInterface $node
- * The node to export.
- *
- * @return
- * A string representing the node and its children in the book hierarchy in a
- * format determined by the $type parameter.
- *
- * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
- *
- * @see book_menu()
- */
-function book_export($type, EntityInterface $node) {
- $type = drupal_strtolower($type);
-
- $export_function = 'book_export_' . $type;
-
- if (function_exists($export_function)) {
- print call_user_func($export_function, $node);
- }
- else {
- drupal_set_message(t('Unknown export format.'));
- throw new NotFoundHttpException();
- }
-}
-
-/**
- * Generates HTML for export when invoked by book_export().
- *
- * The given node is embedded to its absolute depth in a top level section. For
- * example, a child node with depth 2 in the hierarchy is contained in
- * (otherwise empty)
elements corresponding to depth 0 and depth 1.
- * This is intended to support WYSIWYG output - e.g., level 3 sections always
- * look like level 3 sections, no matter their depth relative to the node
- * selected to be exported as printer-friendly HTML.
- *
- * @param \Drupal\node\Plugin\Core\Entity\Node
- * The node to export.
- *
- * @return
- * A string containing HTML representing the node and its children in
- * the book hierarchy.
- *
- * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
- * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
- */
-function book_export_html(EntityInterface $node) {
- if (user_access('access printer-friendly version')) {
- if (isset($node->book)) {
- $tree = book_menu_subtree_data($node->book);
- $contents = book_export_traverse($tree, 'book_node_export');
- $book_exported_html = array('#theme' => 'book_export_html', '#title' => $node->label(), '#contents' => $contents, '#depth' => $node->book['depth']);
- return drupal_render($book_exported_html);
- }
- else {
- throw new NotFoundHttpException();
- }
- }
- else {
- throw new AccessDeniedHttpException();
- }
-}
/**
* Page callback: Shows the outline form for a single node.
diff --git a/core/modules/book/book.routing.yml b/core/modules/book/book.routing.yml
index 6c8b010..5b4b62e 100644
--- a/core/modules/book/book.routing.yml
+++ b/core/modules/book/book.routing.yml
@@ -18,3 +18,10 @@
_form: 'Drupal\book\BookSettingsForm'
requirements:
_permission: 'administer site configuration'
+
+book_export:
+ pattern: '/book/export/{type}/{node}'
+ defaults:
+ _content: '\Drupal\book\Controller\BookController::bookExport'
+ requirements:
+ _permission: 'access printer-friendly version'
\ No newline at end of file
diff --git a/core/modules/book/lib/Drupal/book/Controller/BookController.php b/core/modules/book/lib/Drupal/book/Controller/BookController.php
index 7b10eaf..0cf7408 100644
--- a/core/modules/book/lib/Drupal/book/Controller/BookController.php
+++ b/core/modules/book/lib/Drupal/book/Controller/BookController.php
@@ -6,11 +6,14 @@
namespace Drupal\book\Controller;
+use Drupal\Component\Utility\Unicode;
use Drupal\Core\Controller\ControllerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
+use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Drupal\book\BookManager;
-
+use Drupal\node\NodeInterface;
/**
* Controller routines for book routes.
*/
@@ -85,5 +88,74 @@
$item_list = array('#theme' => 'item_list' , '#items' => $book_list);
return drupal_render($item_list);
}
+ /**
+ * Generates representations of a book page and its children.
+ *
+ * The function delegates the generation of output to helper functions. The
+ * function name is derived by prepending 'book_export_' to the given output
+ * type. So, e.g., a type of 'html' results in a call to the function
+ * book_export_html().
+ *
+ * @param $type
+ * A string encoding the type of output requested. The following types are
+ * currently supported in book module:
+ * - html: Printer-friendly HTML.
+ * Other types may be supported in contributed modules.
+ * @param \Drupal\node\NodeInterface $node
+ * The node to export.
+ *
+ * @return
+ * A string representing the node and its children in the book hierarchy in a
+ * format determined by the $type parameter.
+ *
+ * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
+ */
+ public function bookExport($type, NodeInterface $node) {
+
+ $type = Unicode::strtolower($type);
+ $export_function = 'book_export_' . $type;
+ if (function_exists($export_function)) {
+ print call_user_func($export_function, $node);
+ }
+ else {
+ drupal_set_message(t('Unknown export format.'));
+ throw new NotFoundHttpException();
+ }
+ }
+ /**
+ * Generates HTML for export when invoked by book_export().
+ *
+ * The given node is embedded to its absolute depth in a top level section. For
+ * example, a child node with depth 2 in the hierarchy is contained in
+ * (otherwise empty)
elements corresponding to depth 0 and depth 1.
+ * This is intended to support WYSIWYG output - e.g., level 3 sections always
+ * look like level 3 sections, no matter their depth relative to the node
+ * selected to be exported as printer-friendly HTML.
+ *
+ * @param \Drupal\node\NodeInterface
+ * The node to export.
+ *
+ * @return
+ * A string containing HTML representing the node and its children in
+ * the book hierarchy.
+ *
+ * @throws \Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException
+ * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
+ */
+ public function book_export_html(NodeInterface $node) {
+ if (user_access('access printer-friendly version')) {
+ if (isset($node->book)) {
+ $tree = book_menu_subtree_data($node->book);
+ $contents = book_export_traverse($tree, 'book_node_export');
+ return theme('book_export_html', array('title' => $node->label(), 'contents' => $contents, 'depth' => $node->book['depth']));
+ }
+ else {
+ throw new NotFoundHttpException();
+ }
+ }
+ else {
+ throw new AccessDeniedHttpException();
+ }
+ }
}
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644
index 0000000..94429c9
--- /dev/null
+++ b/nbproject/project.properties
@@ -0,0 +1,7 @@
+include.path=${php.global.include.path}
+php.version=PHP_53
+source.encoding=UTF-8
+src.dir=.
+tags.asp=false
+tags.short=true
+web.root=.
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100644
index 0000000..569f87b
--- /dev/null
+++ b/nbproject/project.xml
@@ -0,0 +1,9 @@
+
+
+ org.netbeans.modules.php.project
+
+
+ drupal
+
+
+