Skip to content

N°9223 - Portal - AttributeExternalKey or AttributeEnum are not displayed after adding a link.#802

Merged
bdalsass merged 3 commits intosupport/3.2from
feature/9223-Portal-AttributeExternalKey_adding
Mar 26, 2026
Merged

N°9223 - Portal - AttributeExternalKey or AttributeEnum are not displayed after adding a link.#802
bdalsass merged 3 commits intosupport/3.2from
feature/9223-Portal-AttributeExternalKey_adding

Conversation

@accognet
Copy link
Copy Markdown
Contributor

internal

@accognet accognet self-assigned this Feb 13, 2026
@CombodoApplicationsAccount CombodoApplicationsAccount added the internal Work made by Combodo label Feb 13, 2026
@accognet accognet changed the base branch from develop to support/3.2 February 13, 2026 16:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where AttributeExternalKey and AttributeEnum fields were not being displayed after adding a link in the portal. The issue was caused by a mismatch between the data structure returned by GetInformationForLinkedSetAsJsonAction and the structure expected by the JavaScript/Twig templates that consume this data.

Changes:

  • Updated the attribute data structure in GetInformationForLinkedSetAsJsonAction to match the expected format used by portal templates and the PrepareObjectInformation method
  • Renamed att_code to attribute_code and value to value_html for consistency with the rest of the codebase
  • Added metadata fields (object_class, object_id, prefix, attribute_type) required by the JavaScript consumers

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 1403 to 1404
'css_inline' => $oFieldOutput->GetCss(),
'js_inline' => $oFieldOutput->GetJs(),
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable $oFieldOutput is used here but it's only defined inside the if block on line 1391-1395. When $sFieldRendererClass is null, $oFieldOutput will be undefined, causing a fatal error. The css_inline and js_inline properties should only be set when $oFieldOutput is available, similar to how it's done in BsLinkedSetFieldRenderer::PrepareItem (lines 880-887 in sources/Renderer/Bootstrap/FieldRenderer/BsLinkedSetFieldRenderer.php).

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bdalsass @accognet I think this comment is still valid and should not be overlooked don't you think?

Comment on lines 1396 to 1405
$aObjectData['attributes']['lnk__'.$sAttCode] = [
'att_code' => $sAttCode,
'value' => $sValue,
'object_class' => $sLinkClass,
'object_id' => $oNewLink->GetKey(),
'prefix' => 'lnk__',
'attribute_code' => $sAttCode,
'attribute_type' => get_class($oAttDef),
'value_html' => $sValue,
'css_inline' => $oFieldOutput->GetCss(),
'js_inline' => $oFieldOutput->GetJs(),
];
Copy link

Copilot AI Feb 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The data structure is missing the 'value_raw' field which is present in both PrepareObjectInformation (line 1462) and BsLinkedSetFieldRenderer::PrepareItem (line 866 in sources/Renderer/Bootstrap/FieldRenderer/BsLinkedSetFieldRenderer.php). For consistency and to maintain the same data structure across similar methods, 'value_raw' should be included here as well, following the same exclusion logic based on ApplicationHelper::GetAttDefClassesToExcludeFromMarkupMetadataRawValue().

Copilot uses AI. Check for mistakes.
Comment on lines 1403 to 1404
'css_inline' => $oFieldOutput->GetCss(),
'js_inline' => $oFieldOutput->GetJs(),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Copilot, the $oFieldOutput var can be undefined there, so you can't do this.

@accognet accognet force-pushed the feature/9223-Portal-AttributeExternalKey_adding branch from c83282b to 7d66d45 Compare March 24, 2026 21:15
@Molkobain Molkobain requested a review from Copilot March 24, 2026 21:23
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bdalsass bdalsass merged commit df8b25d into support/3.2 Mar 26, 2026
@bdalsass bdalsass deleted the feature/9223-Portal-AttributeExternalKey_adding branch March 26, 2026 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Work made by Combodo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants