Issue #3099971 by huzooka: Hard-coded uri string in WorkflowListBuilder breaks if Drupal is installed in (webroot) subfolder
(cherry picked from commit 49b03d9954
)
merge-requests/64/head
parent
cf2a659a5b
commit
049ddc9d58
|
@ -7,6 +7,7 @@ use Drupal\Core\Config\Entity\ConfigEntityListBuilder;
|
|||
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 @@ class WorkflowListBuilder extends ConfigEntityListBuilder {
|
|||
$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;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Drupal\Tests\workflows\Functional;
|
||||
|
||||
use Drupal\Core\Url;
|
||||
use Drupal\Tests\BrowserTestBase;
|
||||
|
||||
/**
|
||||
|
@ -46,6 +47,16 @@ class WorkflowUiNoTypeTest extends BrowserTestBase {
|
|||
$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.
|
||||
|
|
Loading…
Reference in New Issue