Repository navigation
Expand file tree
/
Copy pathburn.module
More file actions
104 lines (98 loc) · 2.79 KB
/
Copy pathburn.module
File metadata and controls
104 lines (98 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
define('PER_ROLE', "administer nodes");
function burn_menu()
{
$items = array();
$items['admin/burn'] = array(
'title' => 'Burn',
'description' => 'Admin to burn modules.',
'page callback' => 'system_admin_menu_block_page',
'access arguments' => array(PER_ROLE),
'file' => 'system.admin.inc',
'file path' => drupal_get_path('module', 'system'),
);
$items['admin/burn/user'] = array(
'title' => 'Burn User',
'page callback' => 'burn_user_admin',
'access arguments' => array(PER_ROLE),
'file' => 'include/burn_user.admin.inc',
);
$items['admin/burn/delete_user/%burn_user_id'] = array(
'title' => 'Burn User delete',
'access arguments' => array(PER_ROLE),
'page arguments' => array(3),
'page callback' => 'burn_user_admin_delete',
'file' => 'include/burn_user.admin.inc',
'type' => MENU_CALLBACK
);
$items['admin/burn/user/%burn_user_id'] = array(
'title' => 'Burn User',
'access arguments' => array(PER_ROLE),
'page arguments' => array(3),
'page callback' => 'burn_user_admin',
'file' => 'include/burn_user.admin.inc',
);
return $items;
}
function burn_entity_info()
{
$entity = array();
$entity['burn_user'] = array(
'label' => t('User burn'),
// defined to .install
'base table' => 'burn_user',
// uri define to function burn_uri url canonikal
'uri callback' => 'burn_uri',
//entity class to use default controller
'entity class' => 'BurnUser',
//first controller
'controller class' => 'BurnController',
//to use fieldapi
'fieldable' => TRUE,
'entity keys' => array(
// id primary
'id' => 'bid',
'name' => 'name',
// use to field_attach
'bundle' => 'type'
),
'bundle keys' => array('bundle' => 'type'),
'bundles' => array(),
'view modes' => array(),
);
return $entity;
}
/**
* Add function burn_uri
* @param $burn_user
* @return array
*
* Return uri to call entity burn_user
*/
function burn_uri($burn_user)
{
return array('path' => 'burn/' . $burn_user->bid);
}
/**
* Implements hook_help().
*/
function burn_help($path, $arg)
{
switch ($path) {
case 'admin/burn':
return "add hook_help qui sauve pas ;)";
}
}
/**
* Implements hook_view
*/
function burn_user_view($user = NULL, $view_mode = 'full', $langcode)
{
// $user is input to entity_metadata_view_single and hook_load argumente
$content[] = array(
'#markup' => l($user->name, 'burn/' . $user->bid),
);
// Add to field
$content[] = field_attach_view('burn_user', $user, $view_mode);
return $content;
}