1

I need to wrap field in views. I use views with module Responsive grid and have this html.

 <div class="services">
  <div class="row">
    <div class="col-xs-12 col-md-3">
      <h3 class="services-heading" data-thmr="thmr_16"><div class="field-title-for-view" data-thmr="thmr_4 thmr_1">Responsive <span>html</span></div></h3>    
      <div class="services-img" data-thmr="thmr_16"><a href="/responsive-html" data-thmr="thmr_5 thmr_6 thmr_8"><img src="http://dvlk/sites/default/files/services_img_2.png" width="101" height="66" alt="" data-thmr="thmr_7"></a></div>    
      <p class="services-p" data-thmr="thmr_16"><span data-thmr="thmr_9" class="devel-themer-wrapper">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin ultrices sit amet diam eu accumsan.</span></p>      

I want to have this html

<div class="services">
  <div class="row">
    <div class="col-xs-12 col-md-3">
    <article class="mycustomclass">
         <h3 class="services-heading" data-thmr="thmr_16"><div class="field-title-for-view" data-thmr="thmr_4 thmr_1">Responsive <span>html</span></div></h3>    
      <div class="services-img" data-thmr="thmr_16"><a href="/responsive-html" data-thmr="thmr_5 thmr_6 thmr_8"><img src="http://dvlk/sites/default/files/services_img_2.png" width="101" height="66" alt="" data-thmr="thmr_7"></a></div>    
      <p class="services-p" data-thmr="thmr_16"><span data-thmr="thmr_9" class="devel-themer-wrapper">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin ultrices sit amet diam eu accumsan.</span></p>      
    </article>
 </div>

I know that i should use this function hook_preprocess_views_view, hook_preprocess_views_view_fields or hook_preprocess_views_view_field but i don't know how to do it correctly. So how can i have this html without creating *tpl.php file

0

It can be done in the views admin interface in the next way:

  1. Exclude existing fields from display
  2. Add new field Global: Custom text
  3. Display new fields in Custom text filed using tokens

See example enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.