Skip to content

Commit

Permalink
Merge pull request #1678 from GSA/1674-add-search-title-json-data
Browse files Browse the repository at this point in the history
1674 add search title in json data
  • Loading branch information
scottqueen-bixal authored Aug 20, 2024
2 parents 9fd8334 + 371a25e commit d806d06
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,14 @@ const RelativeBenefitList = ({ data, carrotType }) => {
<ul className="bf-usa-card-group usa-card-group">
{data &&
data.map((item, i) => {
const { title, link, cta, body, lifeEventId } = item.lifeEvent
const { title, searchTitle, link, cta, body, lifeEventId } =
item.lifeEvent
const trimedLifeEventId = lifeEventId.replace('es_', '')

return (
<Card
className="bf-usa-card--relative-benefit bf-usa-card usa-card tablet:grid-col-12"
title={title}
title={searchTitle || title}
cta={cta}
href={link}
body={body}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,17 @@ public function getData($id) {
// Build Relevant Benefits.
$life_event_form_relevant_benefits = [];
foreach ($relevant_benefits as $relevant_benefit) {

// Get life event node by its ID.
$id = current($relevant_benefit->get('field_b_life_event_form')->referencedEntities())->get('field_b_id')->value;
$life_event_node = $this->getLifeEventById($id, $this->mode);

// Get search title of life event.
$life_event_search_title = $life_event_node->get('field_b_search_title')->value;

$life_event_form_relevant_benefit = [
"title" => current($relevant_benefit->get('field_b_life_event_form')->referencedEntities())->get('title')->value ?? "",
"searchTitle" => $life_event_search_title ?? "",
"body" => $relevant_benefit->get('field_b_body')->value ?? "",
"link" => $relevant_benefit->get('field_b_link')->value ?? "",
"cta" => $relevant_benefit->get('field_b_cta')->value ?? "",
Expand Down

0 comments on commit d806d06

Please sign in to comment.