Hi - really useful module - thanks.

I'm getting a problem whereby the selected template is lost when editing a content-type. When setting up a new content type I select the required template from the list, and save the content type. If I subsequently edit the content type, the template selection is not persisted and resets to the default.

I would have expected the value selected to persist and not require re-selection.

Comments

WebNewCastle’s picture

In the module file, under:

function node_page_form_node_type_form_alter(&$form, &$from_state) {

and skip down to:

    $form['template']['template'] = array(

you should see this line:

'#default_value' => $template,

I believe if you change it to something like this it will work:

'#default_value' => variable_get('template_'. $form['#node_type']->type, node),
jaybee1001’s picture

WebNewCastle - thanks, will give that a spin.

djmy’s picture

WebNewCastle - thanks for the solution on the default value, it did change it but the only thing is that i still don't see the template change on the page. I only see that the drop down is correctly pointing to the template but it does not reflect on the page (from the content type), and i cleared my cache. Is it working for you?

WebNewCastle’s picture

Hi Djmy,

If I am understanding correctly, the purpose of setting the template in the content type is to make it the default when adding or editing a node, but that it wouldn't affect the display of the content type retroactively (i.e. affect the way existing nodes in the content type are displayed). The module maintainer is welcome to correct me if I am wrong.

Is this what you are referring to when you mention that is doesn't reflect on the page or did I misunderstand?

djmy’s picture

djmy’s picture

hi WebNewCastle, the problem is that when I go and edit the template choice in the Content Type, it does save, but when I go to the individual node page the template change doesn't occur. :-(

WebNewCastle’s picture

Are you saying that after you save your choice in the content type settings and then you go to create a new node of the same content type - that there is a problem at that point? Or are you talking about an existing node that you already created?

djmy’s picture

The problem is to an existing node that i created. Its the "edit" function. Creating a new node works though.

WebNewCastle’s picture

I could be wrong, but I think the way the module is written, setting the template in the content type would primarily just affect creating a new node. But choosing a template when editing a node should cause the node to be displayed with the node template selected.

DenRaf’s picture

Version: 6.x-1.0 » 6.x-1.2
Status: Active » Fixed

WebNewCastle, it is like you describe in #9.

Code added in new release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.