protected function SimplenewsTestBase::setupSubscriptionBlock in Simplenews 8.2
Same name and namespace in other branches
- 3.x tests/src/Functional/SimplenewsTestBase.php \Drupal\Tests\simplenews\Functional\SimplenewsTestBase::setupSubscriptionBlock()
Enable newsletter subscription block.
Parameters
array $settings: ['newsletters'] = Array of newsletters (id => 1) ['message'] = Block message ['link_previous'] = {1, 0} Display link to previous issues ['rss_feed'] = {1, 0} Display RSS-feed icon.
4 calls to SimplenewsTestBase::setupSubscriptionBlock()
- SimplenewsAdministrationTest::testSubscriptionManagement in tests/
src/ Functional/ SimplenewsAdministrationTest.php - Test newsletter subscription management.
- SimplenewsSubscribeTest::testSubscribeAnonymous in tests/
src/ Functional/ SimplenewsSubscribeTest.php - TestSubscribeAnonymous.
- SimplenewsSubscribeTest::testSubscribeAnonymousSingle in tests/
src/ Functional/ SimplenewsSubscribeTest.php - Test anonymous subscription with single opt in.
- SimplenewsSubscribeTest::testSubscribeAuthenticated in tests/
src/ Functional/ SimplenewsSubscribeTest.php - TestSubscribeAuthenticated.
File
- tests/
src/ Functional/ SimplenewsTestBase.php, line 98
Class
- SimplenewsTestBase
- Base class for simplenews web tests.
Namespace
Drupal\Tests\simplenews\FunctionalCode
protected function setupSubscriptionBlock(array $settings = []) {
$settings += [
'newsletters' => [],
'message' => t('Select the newsletter(s) to which you want to subscribe or unsubscribe.'),
'unique_id' => \Drupal::service('uuid')
->generate(),
];
// Simplify confirmation form submission by hiding the subscribe block on
// that page. Same for the newsletter/subscriptions page.
$settings['visibility']['request_path']['pages'] = "newsletter/confirm/*\nnewsletter/subscriptions";
$settings['visibility']['request_path']['negate'] = TRUE;
$settings['region'] = 'sidebar_first';
return $this
->drupalPlaceBlock('simplenews_subscription_block', $settings);
}