Is it possible to change the content type on nodes

2019-06-18 19:03发布

I have inherited a Drupal site on which (for some reason) there are two different content types for news: one for press releases and one for everything else. I would like to combine the two and use a taxonomy to categorize the press releases and other news types.

Is it even possible to do this? The site is using a number of modules, including Views and CCK, and I don't know how much a change like this would affect module data.

4条回答
乱世女痞
2楼-- · 2019-06-18 19:20

Of course it's possible. The change won't necessarily be difficult if you've got a good understanding of how each content type is being used. You'll just need to be careful as it's a fundamental change.

If you think that the two different content types are not warranted and it is, in fact duplication of information then you could justify merging the two. Good house keeping!

You could phase out the unwanted content type over time and then when you're confident you've got it just right, build your self a merge module to move the old nodes into the new format. You could also build yourself test views and content types that you can dispose of later.

It may also help to install the devel module to get a programmatic overview of what your nodes look like. You shouldn't leave this module running on live sites as it effects performance.

Sometimes, there's a fair amount of crossover between content taxonomy and content types. It helps to ask yourself: What is a classification of an object and what's an attribute?

查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-06-18 19:26

It is possible to change the content type of nodes.
The problem is if the content types use different CCK fields, which are present in a content type but not in the other. In such case, if you change the content type, those fields would not appear in the converted node; you should convert all those fields manually, or create a custom module to do that.

查看更多
Juvenile、少年°
4楼-- · 2019-06-18 19:34

Is it possible? Yes.

Is it easy? No.

To quote a well used phrase:

If it ain't broke, don't fix it.

You can get your site to work like you describe, and if you started with a clean site that you were going to build, it would be no problem. It's just a matter of choice. Now when you do have a database with views, content and other stuff, it wont be easy. You would have to:

  • Go through all the views, and set them up to use taxonomy and the 1 content type.
  • Migrate all the data into 1 content type. This might evolve setting up CCK for this content type to fit both, and take this into consideration when migrating the data.
  • It's possible the content types are used elsewhere, in custom modules, settings etc, these need to be tracked down and fixed as well.

So it's a lot of work with little/no gain.

查看更多
Deceive 欺骗
5楼-- · 2019-06-18 19:43

http://drupal.org/project/node_convert

The module linked above works extremely well for migrating nodes from one content type to another.

When you are done, you can then use VBO (http://drupal.org/project/views_bulk_operations) to mass manipulate the taxonomy changes you need.

查看更多
登录 后发表回答