-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbancho_gaapi_ranking_weekly.module
More file actions
executable file
·46 lines (40 loc) · 1.52 KB
/
bancho_gaapi_ranking_weekly.module
File metadata and controls
executable file
·46 lines (40 loc) · 1.52 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
<?php
// 日本語
/**
* Display help and module information
* @param section which section of the site we're displaying help
* @return help text for section
*/
function bancho_gaapi_ranking_weekly_help($path, $arg) {
switch ($path) {
case 'admin/modules#description':
return 'Google Analyticsのデータを自動取得してランキング記事を作成';
break;
}
}
/**
* Implements hook_menu(). */
function bancho_gaapi_ranking_weekly_menu() {
$items = array();
// ↓ノードタイプを登録してるわけじゃないからメニューで定義必要
$items['node/add/bancho_gaapi_ranking_weekly'] = array(
'title' => '週間ランキング記事の作成',
'description' => 'Google Analyticsのデータを自動取得してランキング記事を作成(またはnidを指定してランキング記事を作成)',
'page callback' => 'bancho_gaapi_ranking_weekly_main',
'file' => 'bancho_gaapi_ranking_weekly.inc',
'access arguments' => array('access bancho_gaapi'),
'type' => MENU_NORMAL_ITEM,
);
return $items;
}
/**
* Implements hook_form_alter().
*/
function bancho_gaapi_ranking_weekly_form_node_form_alter(&$form, &$form_state, $form_id) {
// 対象のときだけincファイルのルーチンを呼び出し
if (isset($form['#node']->bancho_gaapi_ranking_weekly)) {
module_load_include('inc', 'bancho_gaapi_ranking_weekly', 'bancho_gaapi_ranking_weekly');
bancho_gaapi_ranking_weekly_form_alter_main($form, $form_state, $form_id);
}
}