updated core to 8.6.1 via composer
This commit is contained in:
@@ -246,7 +246,8 @@ interface BookManagerInterface {
|
||||
* A data structure representing the tree as returned from buildBookOutlineData.
|
||||
*
|
||||
* @return array
|
||||
* A structured array to be rendered by drupal_render().
|
||||
* A structured array to be rendered by
|
||||
* \Drupal\Core\Render\RendererInterface::render().
|
||||
*
|
||||
* @see \Drupal\Core\Menu\MenuLinkTree::build
|
||||
*/
|
||||
|
||||
@@ -110,7 +110,6 @@ interface BookOutlineStorageInterface {
|
||||
*/
|
||||
public function insert($link, $parents);
|
||||
|
||||
|
||||
/**
|
||||
* Updates book reference for links that were moved between books.
|
||||
*
|
||||
|
||||
@@ -154,7 +154,7 @@ class BookController extends ControllerBase {
|
||||
|
||||
// @todo Convert the custom export functionality to serializer.
|
||||
if (!method_exists($this->bookExport, $method)) {
|
||||
drupal_set_message(t('Unknown export format.'));
|
||||
$this->messenger()->addStatus(t('Unknown export format.'));
|
||||
throw new NotFoundHttpException();
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ class BookAdminEditForm extends FormBase {
|
||||
}
|
||||
}
|
||||
|
||||
drupal_set_message($this->t('Updated book %title.', ['%title' => $form['#node']->label()]));
|
||||
$this->messenger()->addStatus($this->t('Updated book %title.', ['%title' => $form['#node']->label()]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Drupal\book\Form;
|
||||
use Drupal\book\BookManagerInterface;
|
||||
use Drupal\Component\Datetime\TimeInterface;
|
||||
use Drupal\Core\Entity\ContentEntityForm;
|
||||
use Drupal\Core\Entity\EntityManagerInterface;
|
||||
use Drupal\Core\Entity\EntityRepositoryInterface;
|
||||
use Drupal\Core\Entity\EntityTypeBundleInfoInterface;
|
||||
use Drupal\Core\Form\FormStateInterface;
|
||||
use Drupal\Core\Url;
|
||||
@@ -35,8 +35,8 @@ class BookOutlineForm extends ContentEntityForm {
|
||||
/**
|
||||
* Constructs a BookOutlineForm object.
|
||||
*
|
||||
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
|
||||
* The entity manager.
|
||||
* @param \Drupal\Core\Entity\EntityRepositoryInterface $entity_repository
|
||||
* The entity repository.
|
||||
* @param \Drupal\book\BookManagerInterface $book_manager
|
||||
* The BookManager service.
|
||||
* @param \Drupal\Core\Entity\EntityTypeBundleInfoInterface $entity_type_bundle_info
|
||||
@@ -44,8 +44,8 @@ class BookOutlineForm extends ContentEntityForm {
|
||||
* @param \Drupal\Component\Datetime\TimeInterface $time
|
||||
* The time service.
|
||||
*/
|
||||
public function __construct(EntityManagerInterface $entity_manager, BookManagerInterface $book_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL) {
|
||||
parent::__construct($entity_manager, $entity_type_bundle_info, $time);
|
||||
public function __construct(EntityRepositoryInterface $entity_repository, BookManagerInterface $book_manager, EntityTypeBundleInfoInterface $entity_type_bundle_info = NULL, TimeInterface $time = NULL) {
|
||||
parent::__construct($entity_repository, $entity_type_bundle_info, $time);
|
||||
$this->bookManager = $book_manager;
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class BookOutlineForm extends ContentEntityForm {
|
||||
*/
|
||||
public static function create(ContainerInterface $container) {
|
||||
return new static(
|
||||
$container->get('entity.manager'),
|
||||
$container->get('entity.repository'),
|
||||
$container->get('book.manager'),
|
||||
$container->get('entity_type.bundle.info'),
|
||||
$container->get('datetime.time')
|
||||
@@ -113,7 +113,7 @@ class BookOutlineForm extends ContentEntityForm {
|
||||
);
|
||||
$book_link = $form_state->getValue('book');
|
||||
if (!$book_link['bid']) {
|
||||
drupal_set_message($this->t('No changes were made'));
|
||||
$this->messenger()->addStatus($this->t('No changes were made'));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -121,15 +121,15 @@ class BookOutlineForm extends ContentEntityForm {
|
||||
if ($this->bookManager->updateOutline($this->entity)) {
|
||||
if (isset($this->entity->book['parent_mismatch']) && $this->entity->book['parent_mismatch']) {
|
||||
// This will usually only happen when JS is disabled.
|
||||
drupal_set_message($this->t('The post has been added to the selected book. You may now position it relative to other pages.'));
|
||||
$this->messenger()->addStatus($this->t('The post has been added to the selected book. You may now position it relative to other pages.'));
|
||||
$form_state->setRedirectUrl($this->entity->urlInfo('book-outline-form'));
|
||||
}
|
||||
else {
|
||||
drupal_set_message($this->t('The book outline has been updated.'));
|
||||
$this->messenger()->addStatus($this->t('The book outline has been updated.'));
|
||||
}
|
||||
}
|
||||
else {
|
||||
drupal_set_message($this->t('There was an error adding the post to the book.'), 'error');
|
||||
$this->messenger()->addError($this->t('There was an error adding the post to the book.'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ class BookRemoveForm extends ConfirmFormBase {
|
||||
public function submitForm(array &$form, FormStateInterface $form_state) {
|
||||
if ($this->bookManager->checkNodeIsRemovable($this->node)) {
|
||||
$this->bookManager->deleteFromBook($this->node->id());
|
||||
drupal_set_message($this->t('The post has been removed from the book.'));
|
||||
$this->messenger()->addStatus($this->t('The post has been removed from the book.'));
|
||||
}
|
||||
$form_state->setRedirectUrl($this->getCancelUrl());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace Drupal\book\Plugin\migrate\source;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
|
||||
/**
|
||||
* Drupal 6 and 7 book source.
|
||||
*
|
||||
* @MigrateSource(
|
||||
* id = "book",
|
||||
* source_module = "book",
|
||||
* )
|
||||
*/
|
||||
class Book extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('book', 'b')->fields('b', ['nid', 'bid']);
|
||||
$query->join('menu_links', 'ml', 'b.mlid = ml.mlid');
|
||||
$ml_fields = ['mlid', 'plid', 'weight', 'has_children', 'depth'];
|
||||
foreach (range(1, 9) as $i) {
|
||||
$field = "p$i";
|
||||
$ml_fields[] = $field;
|
||||
$query->orderBy('ml.' . $field);
|
||||
}
|
||||
return $query->fields('ml', $ml_fields);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['mlid']['type'] = 'integer';
|
||||
$ids['mlid']['alias'] = 'ml';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return [
|
||||
'nid' => $this->t('Node ID'),
|
||||
'bid' => $this->t('Book ID'),
|
||||
'mlid' => $this->t('Menu link ID'),
|
||||
'plid' => $this->t('Parent link ID'),
|
||||
'weight' => $this->t('Weight'),
|
||||
'p1' => $this->t('The first mlid in the materialized path. If N = depth, then pN must equal the mlid. If depth > 1 then p(N-1) must equal the parent link mlid. All pX where X > depth must equal zero. The columns p1 .. p9 are also called the parents.'),
|
||||
'p2' => $this->t('The second mlid in the materialized path. See p1.'),
|
||||
'p3' => $this->t('The third mlid in the materialized path. See p1.'),
|
||||
'p4' => $this->t('The fourth mlid in the materialized path. See p1.'),
|
||||
'p5' => $this->t('The fifth mlid in the materialized path. See p1.'),
|
||||
'p6' => $this->t('The sixth mlid in the materialized path. See p1.'),
|
||||
'p7' => $this->t('The seventh mlid in the materialized path. See p1.'),
|
||||
'p8' => $this->t('The eighth mlid in the materialized path. See p1.'),
|
||||
'p9' => $this->t('The ninth mlid in the materialized path. See p1.'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
namespace Drupal\book\Plugin\migrate\source\d6;
|
||||
|
||||
use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
use Drupal\book\Plugin\migrate\source\Book as BookGeneral;
|
||||
|
||||
@trigger_error('Book is deprecated in Drupal 8.6.x and will be removed before Drupal 9.0.x. Use \Drupal\book\Plugin\migrate\source\Book instead. See https://www.drupal.org/node/2947487 for more information.', E_USER_DEPRECATED);
|
||||
|
||||
/**
|
||||
* Drupal 6 book source.
|
||||
@@ -11,54 +13,9 @@ use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
|
||||
* id = "d6_book",
|
||||
* source_module = "book"
|
||||
* )
|
||||
*
|
||||
* @deprecated in Drupal 8.6.x, to be removed before Drupal 9.0.x. Use
|
||||
* \Drupal\book\Plugin\migrate\source\Book instead. See
|
||||
* https://www.drupal.org/node/2947487 for more information.
|
||||
*/
|
||||
class Book extends DrupalSqlBase {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
$query = $this->select('book', 'b')->fields('b', ['nid', 'bid']);
|
||||
$query->join('menu_links', 'ml', 'b.mlid = ml.mlid');
|
||||
$ml_fields = ['mlid', 'plid', 'weight', 'has_children', 'depth'];
|
||||
for ($i = 1; $i <= 9; $i++) {
|
||||
$field = "p$i";
|
||||
$ml_fields[] = $field;
|
||||
$query->orderBy('ml.' . $field);
|
||||
}
|
||||
$query->fields('ml', $ml_fields);
|
||||
return $query;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getIds() {
|
||||
$ids['mlid']['type'] = 'integer';
|
||||
$ids['mlid']['alias'] = 'ml';
|
||||
return $ids;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function fields() {
|
||||
return [
|
||||
'nid' => $this->t('Node ID'),
|
||||
'bid' => $this->t('Book ID'),
|
||||
'mlid' => $this->t('Menu link ID'),
|
||||
'plid' => $this->t('Parent link ID'),
|
||||
'weight' => $this->t('Weight'),
|
||||
'p1' => $this->t('The first mlid in the materialized path. If N = depth, then pN must equal the mlid. If depth > 1 then p(N-1) must equal the parent link mlid. All pX where X > depth must equal zero. The columns p1 .. p9 are also called the parents.'),
|
||||
'p2' => $this->t('The second mlid in the materialized path. See p1.'),
|
||||
'p3' => $this->t('The third mlid in the materialized path. See p1.'),
|
||||
'p4' => $this->t('The fourth mlid in the materialized path. See p1.'),
|
||||
'p5' => $this->t('The fifth mlid in the materialized path. See p1.'),
|
||||
'p6' => $this->t('The sixth mlid in the materialized path. See p1.'),
|
||||
'p7' => $this->t('The seventh mlid in the materialized path. See p1.'),
|
||||
'p8' => $this->t('The eighth mlid in the materialized path. See p1.'),
|
||||
'p9' => $this->t('The ninth mlid in the materialized path. See p1.'),
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
class Book extends BookGeneral {}
|
||||
|
||||
Reference in New Issue
Block a user