foreach ($associated_objects_array as $key => $value) {
    ?>
    <dl class="islandora-basic-collection-object <?php 
    print $value['class'];
    ?>
">
        <dt class="islandora-basic-collection-thumb"><?php 
    print $value['thumb_link'];
    ?>
</dt>
      <dd class="islandora-basic-collection-caption"><?php 
    print filter_xss($value['title_link']);
    ?>
</dd>
      <?php 
    if (!empty($value['solr_data']['mods_abstract_ms'][0])) {
        ?>
      <dd class="islandora-mods-abstract"><?php 
        print filter_xss(views_trim_text($alter, $value['solr_data']['mods_abstract_ms'][0]));
        ?>
</dd>
      <?php 
    }
    ?>
    </dl>
  <?php 
}
?>
</div>
</div>
<div class="field-name-field-fam-breeding">

<?php 
//trim the text with http://api.drupalize.me/api/drupal/function/views_trim_text/7
$items_trim = array('max_length' => 300, 'word_boundary' => TRUE, 'ellipsis' => TRUE, 'html' => TRUE);
global $user;
if (arg(0) == 'node' && is_numeric(arg(1))) {
    $flag = flag_get_flag('highlighted');
}
if (empty($user->roles[5]) && empty($user->roles[6]) && empty($user->roles[7]) && empty($user->roles[4]) && empty($user->roles[3]) && (isset($flag) && !$flag->is_flagged($element['#object']->nid))) {
    print views_trim_text($items_trim, render($items));
    print '<span class="hide-text"></span><div class="avis">You are reading a trimmed version of the Breeding section.<br />Only members are able to see the rest of the text. To make the most of all of HBW\'s features, discover our subscriptions now.<div class="btn-container"><a title="Compare subscriptions" class="btn" href="/pricing">HBW Alive Plans & Pricing</a>&nbsp;&nbsp;' . l('Why subscribe', 'subscription-plans', array('attributes' => array('title' => t('Why subscribe ?'), 'class' => 'btn'))) . '<div class="sign-in">or <a title="Sign in now if you already have a membership" href="/user">sign in</a> if you already have a membership</div></div></div>';
} else {
    print render($items);
}
?>

</div>
} else {
    ?>
        <div class="right thumbnail col-sm-4 teaser-img-small"><?php 
    print $post_media;
    ?>
</div>
    <?php 
}
?>

    <h2><a href="<?php 
print $blog_entry['path_alias'];
?>
"><?php 
print $blog_entry['title'];
?>
</a></h2>

<?php 
print views_trim_text(array('max_length' => 150), $blog_entry['body']) . '...';
?>

<p><a href="<?php 
print $blog_entry['path_alias'];
?>
"><strong><?php 
print $blog_entry['botton_label'];
?>
</strong> <i class="icon-arrow-right icon-white"></i></a>
</p>
</li>
Пример #4
0
function _bellcom_text_shortener($text_string, $max_length)
{
    $alter = array('max_length' => $max_length, 'ellipsis' => TRUE, 'word_boundary' => TRUE, 'html' => TRUE);
    $shortened_string = views_trim_text($alter, $text_string);
    return $shortened_string;
}
Пример #5
0
" title="<?php 
    print $title;
    ?>
"><?php 
    print $title;
    ?>
</a></h2>
    <?php 
    print render($title_suffix);
    ?>
    <?php 
    //trim the text with http://api.drupalize.me/api/drupal/function/views_trim_text/7
    $alter_taxo_c = array('max_length' => 225, 'word_boundary' => TRUE, 'ellipsis' => TRUE, 'html' => TRUE);
    print '<div class="ds-taxonomy"><span class="label">Taxonomy: </span> <span class="name_desc">' . render($content['field_sp_name_desc'][0]) . '</span> <span class="descriptor">' . render($content['field_sp_descriptor'][0]) . ',</span> <span class="year">' . render($content['field_sp_year'][0]) . '</span>, <span class="type_locality">' . render($content['field_sp_type_locality'][0]) . ',</span><div class="taxo_comments">' . views_trim_text($alter_taxo_c, render($content['field_sp_taxo_comments'][0])) . '</div></div>';
    $alter_dn = array('max_length' => 225, 'word_boundary' => TRUE, 'ellipsis' => TRUE, 'html' => TRUE);
    print '<strong>Descriptive notes:</strong> ' . views_trim_text($alter_dn, render($content['field_sp_descr_notes'][0]));
    print '<div class="more"><a href="' . $node_url . '" title="' . $title . '">read more</a></div>';
    ?>
  </div>
  
  <div class="right">
  <?
  // si privileged user, mostrar la figure sense watermark
  if (!empty($account->roles[5]) || !empty($account->roles[6]) || !empty($account->roles[7]) || !empty($account->roles[4]) || !empty($account->roles[3])) {
    //print '<div class="thumbnail">' . views_embed_view('species_figure','block_4', $element['#object']->nid) . '</div>'; // l'argument ja està en la view
    print '<div class="thumbnail">' . views_embed_view('species_figure','block_5', $node->nid) . '</div>';
  }
  else {
    print '<div class="thumbnail">' . views_embed_view('species_figure','block_5', $node->nid) . '</div>'; // CANVIEM A UN FORMATTER AMB WATERMARK??
  }
  //print theme('image_style', array('style_name' => 'icon', 'path' => render($content['field_sp_map_jpg'][0]))) . '</div>';
function unity_lab_it_preprocess_paragraphs_item_event_spotlight_section(&$vars, $hook)
{
    //Get Event Spotlight
    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'node')->propertyCondition('promote_home_event_spotlight', 1)->propertyCondition('status', 1)->propertyOrderBy('created', 'DESC')->range(0, 1);
    //do not forget the semicolon at the end of the query conditions
    $result = $query->execute();
    if (isset($result['node'])) {
        $nids = array_keys($result['node']);
        $spotlights = entity_load('node', $nids);
    }
    foreach ($spotlights as $spotlight) {
        $vars['content']['spotlight']['url'] = url('node/' . $spotlight->nid);
        $vars['content']['spotlight']['title'] = $spotlight->title;
        $spotlightIntro = field_get_items('node', $spotlight, 'field_introduction');
        $spotlightIntro = empty($spotlightIntro[0]['value']) ? '' : $spotlightIntro[0]['value'];
        $alter = array('max_length' => 260, 'ellipsis' => TRUE, 'word_boundary' => TRUE);
        $spotlightIntro = strip_tags($spotlightIntro);
        $spotlightIntro = views_trim_text($alter, $spotlightIntro);
        $vars['content']['spotlight']['introduction'] = $spotlightIntro;
        $spotlightImage = field_get_items('node', $spotlight, 'field_spotlight_image');
        if ($spotlightImage) {
            $spotlightImage_render = field_view_value('node', $spotlight, 'field_spotlight_image', $spotlightImage[0], array('settings' => array('image_style' => 'large_crop')));
            $spotlightImage_render['#item']["attributes"]["class"] = array('event-media-highlight-img', 'img-responsive');
            $vars['content']['spotlight']['image'] = render($spotlightImage_render);
        } else {
            $vars['content']['spotlight']['image'] = '<img class="media-card-img img-responsive" src="https://images.unsplash.com/photo-1430760814266-9c81759e5e55?q=80&fm=jpg&s=3276a313ddc63ffca3ce9c6c78c53b62" />';
        }
    }
    //get event flashlights
    $query = new EntityFieldQuery();
    $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'event')->entityCondition('bundle', 'workshop_event')->propertyCondition('status', 1)->fieldCondition('field_start_date', 'value', date("Y-m-d g:i:s"), '>')->fieldOrderBy('field_start_date', 'value', 'ASC')->range(0, 3);
    if ($query) {
        $result = $query->execute();
        if (isset($result['node'])) {
            $nids = array_keys($result['node']);
            $events = entity_load('node', $nids);
        }
    }
    foreach ($events as $event) {
        $resource = array();
        $resource['url'] = url('node/' . $event->nid);
        $resource['facebook_share'] = doit_helper_facebook_share($event);
        $resource['twitter_share'] = doit_helper_twitter_share($event);
        $resource['yammer_share'] = doit_helper_yammer_share($event);
        $resource['title'] = $event->title;
        $start = field_get_items('node', $event, 'field_start_date');
        $start = empty($start[0]['value']) ? '' : $start[0]['value'];
        if ($start) {
            $start = new DateObject($start, 'UTC');
            $start->setTimeZone(new DateTimeZone('America/New_York'));
            $resource['date'] = $start->format('F jS, Y g:i a');
            $resource['date-only'] = $start->format('F jS, Y');
            $resource['time-only'] = $start->format('g:i a');
        }
        //  $startTZ = empty($start[0]['timezone_db']) ? '' : $start[0]['timezone_db'];
        //$start = new DateTime($startVal, $startTZ);
        $regLink = field_get_items('node', $event, 'field_third_party_registration_l');
        $regLink = _unity_lab_it_link_array($regLink);
        $curDate = new DateObject('UTC');
        $curDate->setTimeZone(new DateTimeZone('America/New_York'));
        if ($curDate < $start) {
            $resource['registration-url'] = $regLink;
            $googleURL = doit_helper_event_add_cal_url($event);
            $resource['add-to-cal'] = $googleURL;
        }
        $room = field_get_items('node', $event, 'field_room');
        $room = empty($room[0]['target_id']) ? '' : $room[0]['target_id'];
        if ($room) {
            $room = node_load($room);
        }
        if ($room) {
            $resource['room'] = $room->title;
        }
        $audienceItems = '';
        $eventIntro = '';
        if ($event->type == 'event') {
            $audienceItems = field_get_items('node', $event, 'field_audience');
            $eventIntro = field_get_items('node', $event, 'field_introduction');
            $eventIntro = empty($eventIntro[0]['value']) ? '' : $eventIntro[0]['value'];
        } else {
            if ($event->type == 'workshop_event') {
                $workshop = field_get_items('node', $event, 'field_workshop');
                $workshop = empty($workshop[0]['target_id']) ? '' : $workshop[0]['target_id'];
                if ($workshop) {
                    $workshop = node_load($workshop);
                    $audienceItems = field_get_items('node', $workshop, 'field_audience');
                    $eventIntro = field_get_items('node', $workshop, 'field_introduction');
                    $eventIntro = empty($eventIntro[0]['value']) ? '' : $eventIntro[0]['value'];
                }
            }
        }
        $alter = array('max_length' => 190, 'ellipsis' => TRUE, 'word_boundary' => TRUE);
        $eventIntro = strip_tags($eventIntro);
        $eventIntro = views_trim_text($alter, $eventIntro);
        $resource['introduction'] = $eventIntro;
        $audience = '';
        foreach ($audienceItems as $audItem) {
            $audTax = taxonomy_term_load($audItem['tid']);
            $audience .= $audTax->name . ', ';
        }
        if (strlen($audience) > 0) {
            $resource['audience'] = substr($audience, 0, strlen($audience) - 2);
        }
        $vars['content']['flashlights'][] = $resource;
    }
}
Пример #7
0
/**
 * Implements theme_facetapi_link_inactive().
 */
function dkan_facetapi_link_inactive($variables)
{
    // Builds accessible markup.
    // @see http://drupal.org/node/1316580
    $alter = array('max_length' => 30, 'ellipsis' => TRUE, 'word_boundary' => TRUE, 'trim' => TRUE);
    $variables['text'] = views_trim_text($alter, $variables['text']);
    $accessible_vars = array('text' => $variables['text'], 'active' => FALSE);
    $accessible_markup = theme('facetapi_accessible_markup', $accessible_vars);
    // Sanitizes the link text if necessary.
    $sanitize = empty($variables['options']['html']);
    $variables['text'] = $sanitize ? check_plain($variables['text']) : $variables['text'];
    // Adds count to link if one was passed.
    if (isset($variables['count'])) {
        $variables['text'] .= ' ' . theme('facetapi_count', $variables);
    }
    // Resets link text, sets to options to HTML since we already sanitized the
    // link text and are providing additional markup for accessibility.
    $variables['text'] .= $accessible_markup;
    $variables['options']['html'] = TRUE;
    return theme_link($variables);
}