Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Implémentation du hook_block().
- *
- * Génère un ou plusieurs blocs programmatiquement.
- */
- function modblock_block($op = 'list', $delta = 0, $edit = array()) {
- switch ($op) {
- case 'list': // Renvoie la liste de TOUS les blocs.
- $blocks[0] = array(
- 'info' => t('Welcome!'),
- );
- return $blocks;
- case 'view': // Renvoie le contenu d'UN SEUL bloc
- // identifié par $delta.
- if ($delta == 0) {
- if (user_access('access modblock')) {
- $content = t('Welcome! It <is %heure.', array('%heure' => date('H:i')));
- }
- else {
- $content = '';
- }
- $block = array(
- 'subject' => t('Welcome!'),
- 'content' => $content,
- );
- }
- return $block;
- }
- }
- /**
- * Implémentation du hook_perm().
- *
- * Déclare de nouvelles permissions visibles sur
- * Admin > Gestion des utilisateurs > Droits d'accès.
- */
- function modblock_perm() {
- return array('access modblock');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement