The module currently requires that a 'page' content type be used as the header node. It'd be nice to be able to change this to something else that is specific for the site.

Comments

damienmckenna’s picture

Status: Active » Needs review
StatusFileSize
new1.85 KB

Here's a patch that allows the content type to be overridden using a variable "views_header_nodes_type".

joachim’s picture

Status: Needs review » Needs work

That's definitely a feature I'd be happy to include.

The patch is a good start, but rather than a global variable, there should be an option in the plugin. You can crib from this issue for how to make Views plugin options: #915622: option to use view name as base path; to make a UI list of content types see either taxonomy module's admin UI or Views handlers that similarly let you pick a content type.

+++ views_header_nodes_plugin_attachment_header_node.inc	24 Sep 2010 03:34:15 -0000
@@ -153,8 +153,13 @@ class views_header_nodes_plugin_attachme
+      $content_type = check_plain(variable_get('views_header_nodes_type', 'page'));

The check_plain() is moot. Or at least, I hope you trust people who have access to your settings.php! ;)

+++ views_header_nodes_plugin_attachment_header_node.inc	24 Sep 2010 03:34:15 -0000
@@ -165,7 +170,7 @@ class views_header_nodes_plugin_attachme
+        $output = l(t('Add a header'), 'node/add/'. $content_type, $options);

Coding standards for Drupal 6 and beyond put a space either side of the . operator.

Powered by Dreditor.

wiifm’s picture

Hmmm, just realised my issue probably duplicates this #1083458: Feature - control which content type to be used when adding a new view header node - let me know if you want me to close my issue and post the patch here.

wiifm’s picture

Status: Needs work » Needs review
StatusFileSize
new3.1 KB

Closed other issue, in favour of keeping this one alive. Also this patch should include the newly created admin.inc file and also should be pathed correctly

git diff HEAD --no-prefix --relative > ~/views_header_nodes-control-content-type.patch

How does this patch look?

joachim’s picture

Status: Needs review » Needs work

Thanks for the patch! I'd totally forgotten about this issue...

The changes in the handler look good (thanks for removing my todo! :)

But rather than a whole admin UI, I would put the option inside the Views handler. It's cleaner UI and it's overall less code too.