Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to edit Component Links in SDL Tridion UI 2012?

One big "Hi" for all humans from planet Tridion :).

I am trying to make component links editable in SDL Tridion UI 2012.

I have one component that contains multi-valued component links as one of fields.

When I put following in DWT

<!-- TemplateBeginRepeat name="componentLink" -->
 <!-- TemplateBeginIf cond="TemplateRepeatIndex<3" -->
  <li> 
   <a href="#" tridion:href="@@RenderComponentField(FieldPath+"componentLink",TemplateRepeatIndex)@@">
    Link${TemplateRepeatIndex}
   </a>  
  </li> 
 <!-- TemplateEndIf -->
<!-- TemplateEndRepeat -->

Inside Template Builder as a result I got following:

<li><a href="#" tridion:href="<tcdl:ComponentField name="componentLink" index="0">tcm:8-625</tcdl:ComponentField>">Link0</a></li> 
<li><a href="#" tridion:href="<tcdl:ComponentField name="componentLink" index="1">tcm:8-626</tcdl:ComponentField>">Link1</a></li> 
<li><a href="#" tridion:href="<tcdl:ComponentField name="componentLink" index="2">tcm:8-627</tcdl:ComponentField>">Link2</a></li> 

As expected an error occured on "Default Finish Actions" on a page level

Unable to find proper value for tridion:href

Is it needed to extract component links inside C# TBB in some previous action or exist any other way to resolve this( Enabling component links for SDL Tridion UI)?

like image 208
Bogdan Stojanovic Avatar asked May 28 '12 09:05

Bogdan Stojanovic


2 Answers

In my "new UI VM" I have the following code in a design:

<tcdl:ComponentField name="LinkText">
  <a tridion:href="@@Component.Fields.Target@@">${LinkText}</a>
</tcdl:ComponentField>

The linked Component is editable in the new UI. The tcdl:ComponentField is processed to wrap the appropriate in-context editing instructions around the link. You should be able translate that on to your code pretty easily...

like image 102
Jeremy Grand-Scrutton Avatar answered Nov 16 '22 11:11

Jeremy Grand-Scrutton


Thank you Jeremy, manually adding <tcdl:ComponentField> tag resolve this issue.

Here is final code that correctly resolve component links on a page level:

<!-- TemplateBeginRepeat name="componentLink" --> 
    <!-- TemplateBeginIf cond="TemplateRepeatIndex<3" --> 
        <li>
            <tcdl:ComponentField name="componentLink">
                 <a tridion:href="@@Field@@">Link${TemplateRepeatIndex} </a>
            </tcdl:ComponentField>  
        </li>
    <!-- TemplateEndIf -->
<!-- TemplateEndRepeat -->
like image 38
Bogdan Stojanovic Avatar answered Nov 16 '22 09:11

Bogdan Stojanovic