I have done a custom node template for displaying into tabs. Here is a part of the code.

<?php
      $empty_test = 'TRUE';
      $test = array();
      $contenu = array();
      $wrapper = entity_metadata_wrapper('node', $node);
      foreach ($wrapper->field_sous_menu as $i){    
        $test[] .= $i->field_test->value();
        if ($i->field_test->value() != NULL){
          $empty_test = 'FALSE';
        }
        $contenu[] .= $i->field_contenu->value();
      } 
?>

<div id="tabs-left" class='vertical-tabs clearfix'>

    <?php if ($empty_test == 'FALSE'){ ?>
    <ul class='vertical-tabs-list'>
    <?php
      foreach ($test as $key => $value){

    ?>     
            <li class="vertical-tab-button"><a href="#tabs-left-<?php echo $key; ?>" name="tabs-left"><?php print $value; ?></a></li>
    <?php
      } 
    ?>
    </ul>
    <?php } ?>
    <?php
      foreach ($contenu as $key => $value){
    ?>      
            <div class="vertical-tabs-panes vertical-tabs-processed" id="tabs-left-<?php echo $key; ?>">
                <?php print $value; ?>
            </div>
    <?php
      }
    ?>
</div> 

What I like to know is if there is a way to display Add, Edit, Remove options into that custom template or by creating a other one ?

Thanks

Comments

RobW’s picture

The operation links (add, edit, delete) are currently added in the #suffix of the field collection field and field collection item render arrays. This basically means that if you're not using the field templates for the field collection field and field collection items, you won't get the operation links. I haven't used entity_metadata_wrappers enough to be able to tell you exactly how they work, but checking if they output the field.tpl and field-collection-item.tpl, and checking dpm($contenu); for the #suffix key is where I would start.

You can also take a look at the patch in #1157794: Move markup to template files and improve theming in new 2.x branch -- with it you should be able to replicate what you're doing here with normal tpls and no entity_metadata_wrapper.

kiero63’s picture

Thanks for this quick answer. I have take a look about your patch and it seems to be the perfect solution for doing what i need. But for various reason i can't apply patch, is there a way to have the already patched file ?

jmuzz’s picture

Issue summary: View changes
Status: Active » Closed (outdated)