Skip to content
Snippets Groups Projects
Commit bcc1f0eb authored by Avi Schwab's avatar Avi Schwab
Browse files

Issue #3369116: Donation page link field should be required

parent 5997006a
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@ entity_type: block_content
bundle: lb_donate
label: 'Donation page link'
description: 'This should link to a donate page with an embedded form.'
required: false
required: true
translatable: true
default_value: { }
default_value_callback: ''
......
......@@ -32,3 +32,16 @@ function lb_donate_update_9001(&$sandbox) {
'field.field.paragraph.lb_donate_giving_amount.field_form_element_id',
]);
}
/**
* Require CTA field too.
*/
function lb_donate_update_9002(&$sandbox) {
$path = \Drupal::service('extension.list.module')->getPath('lb_donate') . '/config/optional';
/** @var \Drupal\config_import\ConfigImporterService $config_importer */
$config_importer = \Drupal::service('config_import.importer');
$config_importer->setDirectory($path);
$config_importer->importConfigs([
'field.field.block_content.lb_donate.field_cta',
]);
}
......@@ -56,7 +56,8 @@ function lb_donate_preprocess_block__lb_donate(&$variables){
$variables['donate']['#items'] = [];
$variables['donate']['#theme'] = 'item_list';
if ($variables["elements"]["content"]["field_cta"] && $donate_uri = $variables["elements"]["content"]["field_cta"]['#items']->first()->uri) {
if ($variables["elements"]["content"]["field_cta"] && isset($variables["elements"]["content"]["field_cta"]['#items'])) {
$donate_uri = $variables["elements"]["content"]["field_cta"]['#items']->first()->uri;
$donate_link = Url::fromUri($donate_uri);
// Validate and create nav from tab list.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment