protected function SimplenewsTestBase::setupSubscriptionBlock in Simplenews 3.x
Same name and namespace in other branches
- 8.2 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.
5 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 without verification.
- SimplenewsSubscribeTest::testSubscribeAuthenticated in tests/
src/ Functional/ SimplenewsSubscribeTest.php - TestSubscribeAuthenticated.
- SimplenewsTestBase::subscribe in tests/
src/ Functional/ SimplenewsTestBase.php - Visits and submits a newsletter management form.
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);
}