-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathyml_tools.module
72 lines (66 loc) · 1.79 KB
/
yml_tools.module
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
<?php
/**
* @file
* YML primary module file.
*/
include_once 'yml_tools.class.inc';
define('YML_TOOLS_STORE_TYPE_UBERCART', 'Ubercart');
define('YML_TOOLS_STORE_TYPE_COMMERCE', 'Commerce');
define('YML_TOOLS_XML_URL', 'products_to_yml.xml');
/**
* Implements hook_menu().
*/
function yml_tools_menu() {
$items = array();
$items[YML_TOOLS_XML_URL] = array(
'title' => 'Export products to YML',
'page callback' => 'yml_tools_get_xml',
'type' => MENU_CALLBACK,
'access arguments' => array('access content'),
);
$items['admin/config/yml_tools'] = array(
'title' => 'Yml export tools (Yandex.market)',
'page callback' => 'drupal_get_form',
'page arguments' => array('yml_tools_admin_settings'),
'access callback' => 'user_access',
'access arguments' => array('administer site configuration'),
'file' => 'yml_tools.admin.inc',
);
return $items;
}
/**
* Callback for YML view page.
*/
function yml_tools_get_xml() {
$strore_creator = new YmlStore();
$store = $strore_creator->createStore();
$store->getXML();
}
/**
* Implements hook_theme().
*/
function yml_tools_theme() {
return array(
'yml_tools_xml' => array(
'variables' => array(
'products' => NULL,
'categories' => NULL,
'currency' => 'RUR',
'name' => variable_get('site_name', 'Drupal'),
'company' => variable_get('site_name', 'Drupal'),
'url' => $GLOBALS['base_url'],
'date' => date('Y-m-d h:i'),
),
'template' => 'yml_tools_xml',
),
'yml_tools_product' => array(
'variables' => array('product' => NULL),
'template' => 'yml_tools_product',
'currency' => 'RUR',
),
'yml_tools_category' => array(
'variables' => array('category' => NULL),
'template' => 'yml_tools_category',
),
);
}