Comments

tim.plunkett’s picture

This is a dupe of #2021161: Replace the fallback node listing with a list controller and #1863906: [PP-1] Replace content revision table with a view.
The second one should probably just be done this way, and save the view for later, but the overview one is RTBC.

damiankloip’s picture

Title: Remove remaining module_load_include() calls in NodeController methods » Remove module_load_include() call from NodeController::revisionOverview()
StatusFileSize
new10.02 KB

Let's just make this for the revisionOverview method

damiankloip’s picture

StatusFileSize
new9.1 KB

rerolled, injected the other dependencies we need. As that's the in thing at the moment..

dawehner’s picture

  1. +++ b/core/modules/node/lib/Drupal/node/Controller/NodeController.php
    @@ -109,11 +149,88 @@ public function revisionPageTitle($node_revision) {
    +        $row[] = $this->t('!date by !username', array('!date' => $this->l($this->date->format($revision->revision_timestamp, 'short'), 'node.revision_show', array('node' => $node->id(), 'node_revision' => $revision->vid)), '!username' => drupal_render($username)))
    +          . (($revision->log != '') ? '<p class="revision-log">' . Xss::filter($revision->log) . '</p>' : '');
    ...
    +        $row[] = array('data' => t('!date by !username', array('!date' => $this->l($this->date->format($revision->revision_timestamp, 'short'), 'node.view', array('node' => $node->id())), '!username' => drupal_render($username)))
    +          . (($revision->log != '') ? '<p class="revision-log">' . Xss::filter($revision->log) . '</p>' : ''),
    

    Topic for a follow up: We could do something like

  2. +++ b/core/modules/node/lib/Drupal/node/Controller/NodeController.php
    @@ -109,11 +149,88 @@ public function revisionPageTitle($node_revision) {
    +    $revert_permission = (($account->hasPermission("revert $type revisions") || $account->hasPermission('revert all revisions') || $account->hasPermission('administer nodes')) && $node->access('update'));
    +    $delete_permission =  (($account->hasPermission("delete $type revisions") || $account->hasPermission('delete all revisions') || $account->hasPermission('administer nodes')) && $node->access('delete'));
    

    I wonder whether it would make sense to abstract into the node access controller.

  3. +++ b/core/modules/node/lib/Drupal/node/Controller/NodeController.php
    @@ -109,11 +149,88 @@ public function revisionPageTitle($node_revision) {
    +      '#attached' => array (
    +        'css' => array(drupal_get_path('module', 'node') . '/css/node.admin.css'),
    +      ),
    

    Can we use a library instead?

damiankloip’s picture

StatusFileSize
new9.6 KB
new1.2 KB

Here is that change to add the attached as a library instead.

I like the idea of adding an access controller for this too!

damiankloip’s picture

StatusFileSize
new9.56 KB
new4.37 KB

Rerolled and made changes for new library stuffs

aron novak’s picture

As I see, here you introduce DI for this class, but if i am not mistaken, it's not really usable to alter the content of the revisions overview. As the renderable array there is only alterable that way if we replace the callback at routing level.

Otherwise, i reviewed the patch in #6, it's fine. (However if https://drupal.org/node/1863906 will be fixed, it won't be needed)

dawehner’s picture

  1. +++ b/core/modules/node/lib/Drupal/node/Controller/NodeController.php
    @@ -109,11 +149,88 @@ public function revisionPageTitle($node_revision) {
    +   * Page callback: Generates an overview table of older revisions of a node.
    

    Well, this is not longer a page callback in strict words.

  2. +++ b/core/modules/node/lib/Drupal/node/Controller/NodeController.php
    @@ -109,11 +149,88 @@ public function revisionPageTitle($node_revision) {
    +    // @todo What to do with node_revision_list()?
    

    Mark it as @deprecated for now and remove it in a follow up?

  3. +++ b/core/modules/node/lib/Drupal/node/Controller/NodeController.php
    @@ -109,11 +149,88 @@ public function revisionPageTitle($node_revision) {
    +        $row[] = array('data' => t('!date by !username', array('!date' => $this->l($this->date->format($revision->revision_timestamp, 'short'), 'node.view', array('node' => $node->id())), '!username' => drupal_render($username)))
    

    Missing $this->t()

As I see, here you introduce DI for this class, but if i am not mistaken, it's not really usable to alter the content of the revisions overview. As the renderable array there is only alterable that way if we replace the callback at routing level.

Not sure what the point here is. You can still try to be part of the usual page flow and alter the render array OR alter the route, for example with a view.

damiankloip’s picture

StatusFileSize
new6.94 KB
new6.37 KB

Needed a reroll, and quite few changes (like getStorageController -> getStorage). node_revision_list() has also already been removed (yay!) so no point in that @todo anymore. Now using the node storage controller to load the revisions.

damiankloip’s picture

StatusFileSize
new10.49 KB
new4.17 KB

Oh, forgot to remove the Page callback part, and remove node_revision_overview again.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Perfect

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 10: 2138073-10.patch, failed testing.

damiankloip’s picture

10: 2138073-10.patch queued for re-testing.

damiankloip’s picture

Status: Needs work » Reviewed & tested by the community
xjm’s picture

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 15: 2138073-psr4-reroll.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review

15: 2138073-psr4-reroll.patch queued for re-testing.

damiankloip’s picture

Status: Needs review » Reviewed & tested by the community
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 68a6ee1 and pushed to 8.x. Thanks!

  • Commit 68a6ee1 on 8.x by alexpott:
    Issue #2138073 by damiankloip, xjm: Remove module_load_include() call...
olli’s picture

+++ b/core/modules/node/src/Controller/NodeController.php
@@ -8,15 +8,54 @@
+  protected $database;

@@ -110,11 +149,128 @@ public function revisionPageTitle($node_revision) {
+  public function page(NodeInterface $node) {

These are not used anymore. Filed #2283049: Remove obsolete NodeController::page() method.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.