1. Change human readable name and description while leaving machine readable name as it is.
<content>
<type>story</type>
<name>New name for Story content type</name>
<description>Put your content type description here.</description>
</content>
2. delete story content type and create new one according to your liking
<content delete="1">
<type>story</type>
</content>
<content>
new content type definition goes here
</content>
Patterns are relying on machine readable name of content type to uniquely identify targeted content type so it is not possible to change it (the same applies to Drupal in general).
Ahhh Hah! It was the lack of quotes that did it. Or didn't do it, as my case might be. Thanks for the info. I wonder if I should start a Handbook Page for the Patterns module to document stuff like this?
While looking at your drupal camp pattern I noticed the following comment which I felt needs some clarification:
Remember that once a content type exists in the db, Patterns will not edit or alter it. To make changes to your content type, you must first delete it using <delete></delete>, then re-create it.
This is actually not correct. Patterns are absolutely capable of modifying existing content types. You can edit and change all the settings, add or delete fields and groups, edit display settings. The ONLY thing that you can't change is machine readable name of existing content type as I explained above.
So there is no need to delete content type and recreate just specify existing content type name as 'type' and enter you new settings. Patterns will always first look for existing content type and update it but if content type is not found, new one will be created.
When updating the content type you need to define tags only for the settings you actually want to change. All other settings will be preserved.
Double quotes for attributes is part of XML syntax, so I would say this comes under writing valid XML and patterns module enforcing that by doing validation check before listing or importing patterns.
Patterns documentation is also underway and we'll be publishing some stuff soon. I'm taking note of all your feedback and questions and making sure that gets mentioned in documentation as well.
Regarding #5, yeah, I figured that out as I was toying around with it, and have corrected my inline documentation, which I will eventually reflect on the http://drupal.org/node/346509 doc page.
<actions>
<!-- CONTENT TYPES -->
<!-- If a content type's "type" exists in the db, Patterns will edit or alter it to
conform to your newly revised Pattern. To replace a default content type
such as the 'story' type, you must first delete it using <delete></delete>,
then re-create it with a new <content></content>. -->
<content delete="TRUE"><!-- First, delete the existing 'story' type. -->
<type>story</type>
</content>
<content><!-- Create a content type for Announcements that replaces 'story'. -->
<name>Announcement</name>
<type>announcement</type>
...
</content>
</actions>
Senpai, I emailed you with a link to the in progress documentation so that you can work from and build on top of that so there isn't duplication of efforts. As soon as things settle down with the D6 release, we can post all of that in the Drupal handbook.
Comments
Comment #1
vaish commentedYou could do one of the following:
1. Change human readable name and description while leaving machine readable name as it is.
2. delete story content type and create new one according to your liking
Patterns are relying on machine readable name of content type to uniquely identify targeted content type so it is not possible to change it (the same applies to Drupal in general).
I hope this helps.
Comment #2
senpai commentedWill Patterns also honor something like <content delete=TRUE> ? It seems more user friendly. This is supposed to be for the average bear, after all.
/me goes off and tries it.
Comment #3
vaish commented<content delete="TRUE"> works fine. (Note that you forgot double quotes around TRUE).
We are working on getting more support for similar user-friendly stuff (yes/no, enable/disable, etc).
Comment #4
senpai commentedAhhh Hah! It was the lack of quotes that did it. Or didn't do it, as my case might be. Thanks for the info. I wonder if I should start a Handbook Page for the Patterns module to document stuff like this?
Comment #5
vaish commentedWhile looking at your drupal camp pattern I noticed the following comment which I felt needs some clarification:
This is actually not correct. Patterns are absolutely capable of modifying existing content types. You can edit and change all the settings, add or delete fields and groups, edit display settings. The ONLY thing that you can't change is machine readable name of existing content type as I explained above.
So there is no need to delete content type and recreate just specify existing content type name as 'type' and enter you new settings. Patterns will always first look for existing content type and update it but if content type is not found, new one will be created.
When updating the content type you need to define tags only for the settings you actually want to change. All other settings will be preserved.
Comment #6
vaish commentedDouble quotes for attributes is part of XML syntax, so I would say this comes under writing valid XML and patterns module enforcing that by doing validation check before listing or importing patterns.
Patterns documentation is also underway and we'll be publishing some stuff soon. I'm taking note of all your feedback and questions and making sure that gets mentioned in documentation as well.
Comment #7
senpai commentedRegarding #5, yeah, I figured that out as I was toying around with it, and have corrected my inline documentation, which I will eventually reflect on the http://drupal.org/node/346509 doc page.
Comment #8
ChrisBryant commentedSenpai, I emailed you with a link to the in progress documentation so that you can work from and build on top of that so there isn't duplication of efforts. As soon as things settle down with the D6 release, we can post all of that in the Drupal handbook.
Thanks for getting the doc page started!
Comment #9
senpai commentedSweet, Thanks. I'm reading up on it now.
Comment #10
senpai commentedFixored.