Unverified Commit 00db219d authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3099971 by huzooka: Hard-coded uri string in WorkflowListBuilder breaks...

Issue #3099971 by huzooka: Hard-coded uri string in WorkflowListBuilder breaks if Drupal is installed in (webroot) subfolder

(cherry picked from commit 49b03d99)
parent e042e936
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityStorageInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
@@ -93,7 +94,7 @@ public function render() {
    $build = parent::render();
    $workflow_types_count = count($this->workflowTypeManager->getDefinitions());
    if ($workflow_types_count === 0) {
      $build['table']['#empty'] = $this->t('There are no workflow types available. In order to create workflows you need to install a module that provides a workflow type. For example, the <a href=":content-moderation">Content Moderation</a> module provides a workflow type that enables workflows for content entities.', [':content-moderation' => '/admin/modules#module-content-moderation']);
      $build['table']['#empty'] = $this->t('There are no workflow types available. In order to create workflows you need to install a module that provides a workflow type. For example, the <a href=":content-moderation">Content Moderation</a> module provides a workflow type that enables workflows for content entities.', [':content-moderation' => Url::fromRoute('system.modules_list', [], ['fragment' => 'module-content-moderation'])->toString()]);
    }
    return $build;
  }
+11 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\Tests\workflows\Functional;

use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;

/**
@@ -46,6 +47,16 @@ public function testWorkflowUiWithNoType() {
    $this->assertSession()->linkExists('Content Moderation');
    $this->assertSession()->pageTextNotContains('Add workflow');

    $this->clickLink('Content Moderation');

    $modules_list_url_absolute = Url::fromRoute('system.modules_list', [], [
      'fragment' => 'module-content-moderation',
      'absolute' => TRUE,
    ])->toString();
    $this->assertSame($this->getSession()->getCurrentUrl(), $modules_list_url_absolute);
    // The current user does not have the 'administer modules' permission.
    $this->assertSession()->statusCodeEquals(403);

    $this->container->get('module_installer')->install(['workflow_type_test']);
    // The render cache needs to be cleared because although the cache tags are
    // correctly set the render cache does not pick it up.