summaryrefslogtreecommitdiff
path: root/modules/blogapi
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-08-28 15:29:34 +0000
committerDries Buytaert <dries@buytaert.net>2005-08-28 15:29:34 +0000
commitc9fc300b1f8fcb00de78aca77bc85d79f4bab5b1 (patch)
tree4979fc5272cebb1a9615a10e6f6435f65caab759 /modules/blogapi
parent494e5ab97cd9a5aa3de9b8db187be2f968a9c46d (diff)
downloadbrdo-c9fc300b1f8fcb00de78aca77bc85d79f4bab5b1.tar.gz
brdo-c9fc300b1f8fcb00de78aca77bc85d79f4bab5b1.tar.bz2
- Patch #29785 by Chx: multiple node types were broken so we refactored
part of the node system! If you have a module that implements node types, you'll have to udpate its CVS HEAD version. We replaced _node_name() and _node_types() by _node(). The new _node() hook let's you define one or more node types, including their names. The implementation of the _node() hook needs to: return array($type1 => array('name' => $name1, 'base' => $base1), $type2 => array('name' => $name2, 'base' => $base2)); where $type is the node type, $name is the human readable name of the type and $base is used instead of <hook> for <hook>_load, <hook>_view, etc. For example, the story module's node hook looks like this: function story_node() { return array('story' => array('name' => t('story'), 'base' => 'story')); } The page module's node hook module like: function page_node() { return array('page' => array('name' => t('page'), 'base' => 'page')); } However, more complex node modules like the project module and the flexinode module can use the 'base' parameter to specify a different base. The project module implements two node types, proejcts and issues, so it can do: function project_node() { return array( array('project_project' => array('name' => t('project'), 'base' => 'project'), array('project_issue' => array('name' => t('issue'), 'base' => 'project_issue')); } In the flexinode module's case there can only one base ... This hook will simplify the CCK, and will make it easy (or easier) to merge the story and page module. In addition, node_list() became node_get_types(). In addition, we created the following functions: node_get_name($type) and node_get_base($type).
Diffstat (limited to 'modules/blogapi')
-rw-r--r--modules/blogapi/blogapi.module10
1 files changed, 3 insertions, 7 deletions
diff --git a/modules/blogapi/blogapi.module b/modules/blogapi/blogapi.module
index 636f77671..f42036d0e 100644
--- a/modules/blogapi/blogapi.module
+++ b/modules/blogapi/blogapi.module
@@ -544,12 +544,8 @@ function blogapi_blogger_title(&$contents) {
function blogapi_settings() {
$output = form_select(t('XML-RPC Engine'), 'blogapi_engine', variable_get('blogapi_engine', 0), array(0 => 'Blogger', 1 => 'MetaWeblog', 2 => 'Movabletype'), t('RSD or Really-Simple-Discovery is a mechanism which allows external blogger tools to discover the APIs they can use to interact with Drupal. Here you can set the preferred method for blogger tools to interact with your site. The common XML-RPC engines are Blogger, MetaWeblog and Movabletype. If you are not sure which is the correct setting, choose Blogger.'));
- foreach (node_list() as $type => $module) {
- $node_types[$type] = node_invoke($type, 'node_name');
- if (in_array($type, array('blog'))) {
- $defaults[] = $type;
- }
- }
+ $node_types = node_get_types();
+ $defaults = isset($node_types['blog']) ? array('blog') : array();
$output .= form_checkboxes(t('Blog types'), "blogapi_node_types", variable_get('blogapi_node_types', $defaults), $node_types, t('Select the content types for which you wish to enable posting via blogapi. Each type will appear as a different "blog" in the client application (if supported).'), 0, 1);
return $output;
}
@@ -716,7 +712,7 @@ function _blogapi_blogid($id) {
function _blogapi_get_node_types() {
$available_types = variable_get('blogapi_node_types', array('blog'));
$types = array();
- foreach (node_list() as $type => $module) {
+ foreach (node_get_types() as $type => $name) {
if (node_access('create', $type) && in_array($type, $available_types)) {
$types[] = $type;
}