Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content field variables added from container screen are incorrect #26348

Closed
bryanboza opened this issue Oct 3, 2023 · 3 comments
Closed

Content field variables added from container screen are incorrect #26348

bryanboza opened this issue Oct 3, 2023 · 3 comments

Comments

@bryanboza
Copy link
Member

bryanboza commented Oct 3, 2023

Problem Statement

The dotContentMap is not working on containers, if you create a container using the following piece of code

<h1>$!{dotContentMap.title}</h1>
<hr />
<p>imageImageWidth: $!{dotContentMap.imageImageWidth}</p>
#if ($UtilMethods.isSet(${imageImageURI})) 
   <p>There should be an image here</p>
   <pre>
       <code>
           $!{dotContentMap}
       </code>
   </pre>
   <img src="$!{dotContentMap.imageImageURI}" alt="$!{dotContentMap.imageImageTitle}"  /> 
#end 
<hr />
#if ($UtilMethods.isSet(${binaryBinaryFileURI})) 
<p>binaryBinaryFileURI:</p>
   <a href="$!{dotContentMap.binaryBinaryFileURI}?force_download=1&filename=$!{dotContentMap.binaryBinaryFileTitle}">$!{dotContentMap.binaryBinaryFileTitle}</a> 
#end 
<hr />

${binaryBinaryFileURI}

Then you use this container in a template, this is not showing anything after you add a new pice of content

Steps to Reproduce

  • Login as admin
  • Create a new content type with 3 fields (TEXT: title BINARY: bin IMAGE: img)
  • Create a container
  • Add the 3 variables of the fields and use the provided code
  • Create a new template using the container
  • Create a new page using the template
  • Add a new piece of content

Acceptance Criteria

  • We need to show the information requested in the container

dotCMS Version

Tested on master

Proposed Objective

Quality Assurance

Proposed Priority

Priority 1 - Show Stopper

@freddyucv freddyucv self-assigned this Oct 3, 2023
@wezell wezell changed the title dotContentMap is not working on containers Content field variables added from container screen are incorrect Oct 4, 2023
@dsilvam dsilvam added the Merged label Oct 4, 2023
@dsilvam
Copy link
Contributor

dsilvam commented Oct 5, 2023

Passed Internal QA.
In order to the the URI of the image you actually need to reference it like this:
<img src="$!{dotContentMap.img.rawUri}" alt="$!{dotContentMap.imgImageTitle}" />

@bryanboza
Copy link
Member Author

We still getting some problems here with the generated code:

Screen.Recording.2023-10-06.at.1.30.30.PM.mov

@bryanboza
Copy link
Member Author

Seems that this behavior is expected when you use a dotAsset file. Tested on a fileAsset and this is working now
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

4 participants