Beispiel #1
0
function mis_theme_get_frontpage_content($language)
{
    $frontpageQuery = new EntityFieldQuery();
    $result = $frontpageQuery->entityCondition('entity_type', 'node')->propertyCondition('type', 'forsida')->propertyCondition('status', 1, '=')->propertyCondition('language', $language, '=')->propertyOrderBy('created', 'DESC')->execute();
    if (!empty($result['node'])) {
        $frontpage = entity_load('node', array_keys($result['node']));
        $frontpage = array_values($frontpage);
        $frontpage = $frontpage[0];
    }
    foreach ($frontpage->field_fs_slider['und'] as $key => &$value) {
        $c = field_collection_field_get_entity($value);
        $value = array('field_image' => isset($c->field_image["und"]) ? scald_atom_load($c->field_image["und"][0]["sid"]) : null, 'field_fyrirsogn' => isset($c->field_fyrirsogn["und"]) ? $c->field_fyrirsogn : null, 'field_fyrirsogn_a_ensku' => isset($c->field_fyrirsogn_a_ensku["und"]) ? $c->field_fyrirsogn_a_ensku : null);
    }
    return $frontpage;
}
?>
</h2>
  <div class="content"<?php 
print $content_attributes;
?>
>
  
    <?php 
// We hide the comments and links now so that we can render them later.
hide($content['comments']);
hide($content['links']);
print render($content);
if ($node->field_boxes['und'][0]['value']) {
    $boxesItem = field_get_items('node', $node, 'field_boxes');
    foreach ($boxesItem as $boxId) {
        $box = field_collection_field_get_entity($boxId);
        if ($box->field_url['und'][0]['value']) {
            print '<div class="boxes-wrapper">
							<table>
								<tr>
									<td>
										<a href="' . $box->field_url['und'][0]['value'] . '"><h2 class="box-title">' . $box->field_title['und'][0]['value'] . '</h2></a>
										<p class="box-body">' . $box->field_footer_text['und'][0]['value'] . '</p>
										<p class="box-link"><a href="' . $box->field_url['und'][0]['value'] . '">READ MORE</a></p>
									</td>
									<td><a href="' . $box->field_url['und'][0]['value'] . '">' . theme_image_style(array('style_name' => 'services', 'path' => $box->field_top_image['und'][0]['uri'], 'alt' => $box->field_top_image['und'][0]['alt'], 'title' => $box->field_top_image['und'][0]['title'])) . '</a></td>
								</tr>
							</table>
						</div>';
        } else {
            print '<div class="boxes-wrapper">