diff --git i18n/i18ncontent/i18ncontent.module i18n/i18ncontent/i18ncontent.module index 814a0c7..8e3e897 100644 --- i18n/i18ncontent/i18ncontent.module +++ i18n/i18ncontent/i18ncontent.module @@ -15,6 +15,15 @@ */ /** + * Implementation of hook_ctools_plugin_directory() + */ +function i18ncontent_ctools_plugin_directory($module, $plugin) { + if ($module == 'page_manager' || $module == 'ctools') { + return 'plugins/' . $plugin; + } +} + +/** * Implementation of hook_help(). */ function i18ncontent_help($path, $arg) { @@ -157,13 +166,15 @@ function i18ncontent_node_type($op, $info) { */ function i18ncontent_menu_alter(&$menu) { $menu['node/add']['page callback'] = 'i18ncontent_node_add_page'; - // @TODO avoid iterating over every router path. - foreach ($menu as $path => $item) { - if (!empty($item['page callback']) && $item['page callback'] == 'node_add') { - $menu[$path]['page callback'] = 'i18ncontent_node_add'; - $arg = arg(NULL, $path); - $menu[$path]['title callback'] = 'i18nstrings_title_callback'; - $menu[$path]['title arguments'] = array('nodetype:type:'. $arg[2] .':name', $item['title']); + if (variable_get('page_manager_node_edit_disabled', TRUE)) { + // @TODO avoid iterating over every router path. + foreach ($menu as $path => $item) { + if (!empty($item['page callback']) && $item['page callback'] == 'node_add') { + $menu[$path]['page callback'] = 'i18ncontent_node_add'; + $arg = arg(NULL, $path); + $menu[$path]['title callback'] = 'i18nstrings_title_callback'; + $menu[$path]['title arguments'] = array('nodetype:type:'. $arg[2] .':name', $item['title']); + } } } } diff --git i18n/i18ncontent/plugins/content_types/i18nform/i18nform.inc i18n/i18ncontent/plugins/content_types/i18nform/i18nform.inc new file mode 100644 index 0000000..10b5b64 --- /dev/null +++ i18n/i18ncontent/plugins/content_types/i18nform/i18nform.inc @@ -0,0 +1,59 @@ + TRUE, + 'render last' => TRUE, + 'title' => t('i18n general form'), + 'icon' => 'icon_form.png', + 'description' => t('Everything in the form that is not displayed by other content.'), + 'required context' => new ctools_context_required(t('Form'), 'form'), + 'category' => t('Form'), +); + +/** + * Output function for the 'node' content type. Outputs a node + * based on the module and delta supplied in the configuration. + */ +function i18ncontent_i18nform_content_type_render($subtype, $conf, $panel_args, &$context) { + $block = new stdClass(); + $block->module = 'form'; + + if (isset($context->form)) { + $block->title = $context->form_title; + if (empty($context->data->nid)) { + $types = node_get_types(); + $type = str_replace('-', '_', $context->data->type); + drupal_set_title(t('Create @name', array('@name' => i18nstrings("nodetype:type:$type:name", $types[$type]->name)))); + } + if (!empty($context->form_id)) { + // If this is a form, drupal_render it. + $block->content = drupal_render($context->form); + } + else { + // Otherwise just spit back what we were given. This is probably an + // error message or something. + $block->content = $context->form; + } + $block->delta = $context->form_id; + } + else { + $block->title = t('Form'); + $block->content = t('Form goes here.'); + $block->delta = 'unknown'; + } + + return $block; +} + +function i18ncontent_i18nform_content_type_admin_title($subtype, $conf, $context) { + return t('"@s" base form', array('@s' => $context->identifier)); +} + +function i18ncontent_i18nform_content_type_edit_form(&$form, &$form_state) { + // provide a blank form so we have a place to override title + // and stuff. +}