Exemple #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;
}
$banner_id = $content['field_cm_banner_id_name'];
$banner_id_name = render($banner_id);
hide($content['field_custom_banner_image']);
hide($content['field_min_width_size']);
hide($content['field_custom_css']);
hide($content['field_cm_banner_image_position']);
hide($content['field_cm_banner_id_name']);
?>

<?php 
$image_url = '';
//Til að fá atom id
$atom_id = $content['field_custom_banner_image']['#items'][0]['sid'];
//til að ná í atom
$atom = scald_atom_load($atom_id);
if (!empty($atom)) {
    //Til að ná í myndaurlið í réttum stíl
    $image_url = image_style_url('custom_banner', $atom->file_source);
}
?>


<style>
	@media only screen and (min-width: <?php 
print render($content['field_min_width_size']);
?>
px) {
		.<?php 
print $banner_id_name;
?>
	<div class="text">
		<a href="<?php 
echo url('node/' . $node->nid);
?>
">
			<h1><?php 
echo $node->title;
?>
</h1>
		</a>
		<?php 
echo render($node->body['und'][0]['safe_value']);
?>
	</div>
	<?php 
if (isset($node->field_hljodskra['und'])) {
    ?>
		<audio controls>
			<?php 
    $audio = scald_atom_load($node->field_hljodskra['und'][0]['sid']);
    ?>
			<source src="<?php 
    echo file_create_url($audio->file_source);
    ?>
" type="audio/mpeg">
			Your browser does not support the audio element.
		</audio>
	<?php 
}
?>
</article>
</h1>
					<?php 
echo $frontpage->field_ci_texti['und'][0]['safe_value'];
?>
				</div>
			</section>
			<section class="authors">
				<?php 
$grein = node_load($frontpage->field_fs_hofundar['und'][0]['target_id']);
?>
				<h1><?php 
echo $grein->title;
?>
</h1>
				<?php 
$img = scald_atom_load($grein->field_image['und'][0]['sid']);
?>
				<img src="<?php 
echo image_style_url('authors', $img->file_source);
?>
" />
				<?php 
echo $grein->body['und'][0]['summary'];
?>
			</section>
			<section class="testimonial">
				<h1><?php 
echo $testimonial->title . ', ' . $testimonial->field_us_stada_titill['und'][0]['safe_value'];
?>
</h1>
				<?php 
<?php

if (isset($node->field_image['und'])) {
    $image = scald_atom_load($node->field_image['und'][0]['sid']);
}
?>
<article class="article">
	<h1><?php 
echo $node->title;
?>
</h1>
	<?php 
echo render($node->body['und'][0]['safe_value']);
?>
	<?php 
if ($image) {
    ?>
		<img src="<?php 
    echo image_style_url('large', $image->file_source);
    ?>
" />
	<?php 
}
?>
</article>
<?php 
//print_r( $node );
                    ?>
</li>
											<?php 
                }
                ?>
										</ul>
									<?php 
            }
            ?>
								</div>
								<?php 
            if (isset($exercise->field_hljodskra['und'])) {
                ?>
									<audio controls>
										<?php 
                $audio = scald_atom_load($exercise->field_hljodskra['und'][0]['sid']);
                ?>
										<source src="<?php 
                echo file_create_url($audio->file_source);
                ?>
" type="audio/mpeg">
										Your browser does not support the audio element.
									</audio>
								<?php 
            }
            ?>
							</article>
						</li>
					<?php 
        }
        ?>
<?php

$image_url = '';
$image_url2 = '';
//$image_url3 = '';
//Til að fá atom id
$atom_id = $content['field_custom_banner_image']['#items'][0]['sid'];
$atom_id2 = $content['field_background_repeat']['#items'][0]['sid'];
//til að ná í atom
$atom = scald_atom_load($atom_id);
$atom2 = scald_atom_load($atom_id2);
//$atom3 	= scald_atom_load($absolute_element);
if (!empty($atom)) {
    //Til að ná í myndaurlið í réttum stíl
    $image_url = image_style_url('custom_banner', $atom->file_source);
}
if (!empty($atom2)) {
    //Til að ná í myndaurlið í réttum stíl
    $image_url2 = image_style_url('custom_banner', $atom2->file_source);
}
$hlekkur = $content['field_custom_banner_hlekkur'];
$breakpoint = $content['field_breakpoint'];
$banner_id = $content['field_cm_banner_id_name'];
$banner_id_name = render($banner_id);
?>

<?php 
hide($content['field_custom_banner_height']);
hide($content['field_custom_banner_image']);
hide($content['field_background_repeat']);
hide($content['field_breakpoint']);