- Vamos al modulo field_collection copiamos el archivo field-collection-item.tpl.php a nuestra carpeta template de nuestra plantilla.
- Le renombramos con el nombre de fiel collection que creamos, por ejemplo he creado en mi tipo de contenido con el nombre "field_slider_group_image". y ahora le cambiamos al nombre "field-collection-item--field_slider_group_image.tpl.php" y modificamos a nuestro gusto.
//Nombre archivo: field-collection-item--field_slider_group_image.tpl.php
<?php /** * @file * Default theme implementation for field collection items. * * Available variables: * - $content: An array of comment items. Use render($content) to print them all, or * print a subset such as render($content['field_example']). Use * hide($content['field_example']) to temporarily suppress the printing of a * given element. * - $title: The (sanitized) field collection item label. * - $url: Direct url of the current entity if specified. * - $page: Flag for the full page state. * - $classes: String of classes that can be used to style contextually through * CSS. It can be manipulated through the variable $classes_array from * preprocess functions. By default the following classes are available, where * the parts enclosed by {} are replaced by the appropriate values: * - entity-field-collection-item * - field-collection-item-{field_name} * * Other variables: * - $classes_array: Array of html class attribute values. It is flattened * into a string within the variable $classes. * * @see template_preprocess() * @see template_preprocess_entity() * @see template_process() */ //dpm($content, "WMB"); ?> <div class="<?php print $classes; ?> clearfix"<?php print $attributes; ?>> <div class="content"<?php print $content_attributes; ?>> <?php // print render($content); if (isset($content['field_slider_main_url_external'][0]['#markup']) != ''): $link = $content['field_slider_main_url_external'][0]['#markup']; print '<a href="' . url($link, array('absolute' => false)) . '">'; print render($content['field_slider_main_image']); print '</a>'; elseif (isset($content['field_slider_main_url_internal'][0]['#href']) != ''): $link = $content['field_slider_main_url_internal'][0]['#href']; print '<a href="' . url($link, array('absolute' => false)) . '">'; print render($content['field_slider_main_image']); print '</a>'; elseif (isset($content['field_slider_main_url_catalog_ta'][0]['#href']) != ''): $link = $content['field_slider_main_url_catalog_ta'][0]['#href']; print '<a href="' . url($link, array('absolute' => false)) . '">'; print render($content['field_slider_main_image']); print '</a>'; else: print render($content['field_slider_main_image']); endif; ?> </div> </div>
No hay comentarios:
Publicar un comentario