restrict page title for visitors

Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
bachy 2013-05-24 19:44:36 +02:00
parent 6c85be6c6d
commit 49db4b90be

View File

@ -28,13 +28,28 @@ function materio_page_title_block_view($delta = '') {
switch ($delta) {
case 'materio_page_title':
$block['subject'] = t('Page title');
$block['content'] = theme('materio_page_title', array('title' => drupal_get_title()));
$block['content'] = theme('materio_page_title', array('title' => materio_page_title_get_title()));
drupal_add_js(drupal_get_path('module', 'materio_page_title').'/js/materio_page_title-ck.js');
break;
}
return $block;
}
function materio_page_title_get_title(){
if (arg(0) == 'node' && $node = node_load(arg(1))) {
if(!user_access('show '.$node->type.' title')){
if($node->type == "materiau"){
$title = field_get_items('node', $node, 'field_nature_titre');
return $title[0]['safe_value'];
}else{
return 'restricted access';
}
}
}
return drupal_get_title();
}
/**
* Implements hook_theme().