didactique page

Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
bachy 2013-05-29 20:29:27 +02:00
parent 1923036d97
commit 2f95c828e6
4 changed files with 56 additions and 3 deletions

View File

@ -9,9 +9,30 @@ function materio_didactique_permission() {
'title' => t('view materio didactique home block'),
'description' => t(''),
),
'access materio didactique page' => array(
'title' => t('access materio didactique page'),
'description' => t(''),
),
);
}
/**
* Implements hook_menu().
*/
function materio_didactique_menu() {
$items['whoweare'] = array(
'title' => 'Who we are',
'page callback' => 'materio_didactique_get_page',
// 'page arguments' => array(),
'access arguments' => array('access materio didactique page'),
'type' => MENU_CALLBACK,
'file' => 'materio_didactique.pages.inc',
);
return $items;
}
/**
* Implements hook_block_info().
*/
@ -65,6 +86,11 @@ function materio_didactique_theme($existing, $type, $theme, $path) {
'template' => 'materio-didactique-home-block',
'path' => drupal_get_path('module', 'materio_didactique').'/templates',
),
'materio_didactique_page' => array(
'arguments' => array('items'=>array()),
'template' => 'materio-didactique-page',
'path' => drupal_get_path('module', 'materio_didactique').'/templates',
)
);
}
@ -78,6 +104,14 @@ function template_preprocess_materio_didactique_home_block(&$vars){
$items[] = node_load($nid);
}
$vars['items'] = $items;
}
function template_preprocess_materio_didactique_page(&$vars){
// dsm($vars, 'template_preprocess_materio_didactique_page | $vars');
$items = array();
foreach ($vars['items'] as $nid => $item) {
$items[] = node_load($nid);
}
$vars['items'] = $items;
}

View File

@ -1 +1,17 @@
<?php
<?php
function materio_didactique_get_page(){
$query = new EntityFieldQuery;
$query
->entityCondition('entity_type', 'node')
->propertyCondition('status', 1)
->entityCondition('bundle', array('didactique'))
// ->fieldCondition('field_displayed_in_home', 'value', 1)
->fieldOrderBy('field_weight', 'value', 'ASC');
$result = $query->execute();
// dsm($result, '$result');
return theme('materio_didactique_page', array('items' => $result['node']));
}

View File

@ -1,3 +1,3 @@
<?php
print render(entity_view('node', $items, 'default'));
print render(entity_view('node', $items, 'teaser'));

View File

@ -0,0 +1,3 @@
<section id="didactique-page">
<?php print render(entity_view('node', $items, 'full')); ?>
</section>