In the process of getting nodewords_nodetype I faced other problems that I didn't face before. While at first I thought I can overcome those bumps in my module, and I kind of did with adding even more logic and a schema to my module, this behavior is still, in my opinion, undesirable.

Basically, the problem is that if you set defaults (say keywords and description) on the default values config screen (admin/content/nodewords/meta-tags) those are filled in automatically when creating a node in the meta tags section, and then, saved to the database. What this means, is that even if I don't set anything specific, the default set at the moment of creation will be stored to the db. Not only this information will be redundant on every node, but it will also mean that if at any point I change the defaults for whatever reason, those defaults wont be used for already created nodes, as those nodes holds the information for the metatags with the old default values.

Of course this behavior affects my module as well, as I should be prioritizing the values filled in a per node basis in favor of the content type defaults, but there will always be information for every node.

I went through your code to try to submit a patch against it, but in the way you have separate the code, this might not be that straightforward. You don't seem to be able to decide if a value was indeed filled by you or the user, even if you leave the form fields empty.

The solution I came up for my module, which now that I think of it can be used as well on yours, and if you do, I can leverage that from it rather than implement it again myself, was to add a checkbox in the Meta tags fieldset on the node's edit form. I called this checkbox "Override defaults with the following values" and I put it right on top of everything else. It's basically the same approach as your default checkbox for robots, but this apply globally to every meta tags. Doing this you can leave the form fields empty and only store/update information if the user actually want's to override the defaults. The default for this checkbox would be unchecked, meaning that the defaults will be used. This also differ from your default checkbox for robots, in which you need to check the box to use the defaults, while the default is what should be used in general. And you can add this checkbox in the nodewords.module as this would be used globally among every meta tags.

I am not sure how much importance you are going to give to this so I guess I might commit this to my module soon and make a release, but I leave this open for discussion.

Comments

hanoii’s picture

I would be able to submit a patch for this if you're interested.

hanoii’s picture

Title: Default changes doesn't reflect on already created nodes » Default changes don't reflect on already created nodes
avpaderno’s picture

I think that the suggested way to proceed is the correct one, and I think I can implement it. Additionally, when the checkbox is not selected, all the form fields should become disabled; in that way, the users would know that they cannot change those values.

avpaderno’s picture

Also, the code change should include an update function that would check the values contained in the database, and remove any rows that contains the default value for that meta tag.

hanoii’s picture

Are you planning on implementing this on 1.x or 3.x? It's hard to keep up with the pace of the releases of nodewords. I'll look into merging my module into nodewords and see if I can submit a patch.

If you are not planning on doing it for 1.x, I'll submit my changes and release a new version of my module. Otherwise I'll wait for your release of this new feature. If you are interested, I can review it before you release it just to check if something's needed.

hanoii’s picture

Also worth mentioning that the robots default checkbox will not be necessary any more.

hanoii’s picture

Actually now that i think of it, my module supports token replacement, and I just found out that yours only supports it on 3.x. And merging this module in 1.x would probably make no sense unless you want me to add token support to the 1.x branch. Otherwise this can be merged to 3.x but not sure what's your preference, if continuing this on a separate module or actually consider merging it.

avpaderno’s picture

Are you planning on implementing this on 1.x or 3.x?

My plan is to add it to branch 6.x-3.

Actually now that i think of it, my module supports token replacement, and I just found out that yours only supports it on 3.x. And merging this module in 1.x would probably make no sense unless you want me to add token support to the 1.x branch.

My plan is to add new features only to branch 6.x-3. Branch 6.x-1 will get only bug fixes, from now on. Also, consider that branch 6.x-3 will require PHP 5.1 or higher (probably 5.2).

Otherwise this can be merged to 3.x but not sure what's your preference, if continuing this on a separate module or actually consider merging it.

If you are talking of merging Nodewords by Node Type into Nodewords, I don't have a preference. If you want to merge it, I would gladly give you access to the Nodewords CVS repository; the module can be a sub-module of Nodewords, and I can help on keeping the module updated with the changes I would make to Nodewords.
Nodewords code could then be made more generic, and allow the admin user to create some conditions (or rules), and to associate to them the meta tags to apply.
I think that the decision about merging the projects is yours; you created the project, and if you see a valid reason to merge them, or you think that merging them can take advantages to your module, then I will give you access to Nodewords CVS. If you decide differently, I will still give you any support for anything you don't understand about how to integrate the modules.

avpaderno’s picture

Version: 6.x-1.5 »
Status: Active » Fixed
StatusFileSize
new65.43 KB

The code has been changed in branch 6.x-3, and committed in CVS.
Thanks for the report.

The attached patch includes the patch given by Dave Reid to update the integration with Vertical Tabs.

hanoii’s picture

Status: Fixed » Needs work

Just reviewed the patch, not really test it but looked briefly at it.

Also bare in mind that I am talking with the 1.x code in mind, but I guess the layout of it shouldn't be very different in 3.x.

I might be looking into it soon.

I think the way you've implemented is not very practical. At first you seem to have implemented on each meta tag module handler, while defaults should really handled by the API rather than by each meta tag. And finally, it seems that having one override checkbox by meta tag is a bit too much. I would have thought that one single checkbox for the whole meta tags section of each node would be sufficient.

Well, for now throwing ideas, I know you are working hard on this module and now you have to support two branches so if you don't get to this issue I might be able to submit a patch to it soon.

avpaderno’s picture

  • There is a checkbox for each meta tag for two reasons.
    • Having a checkbox per meta tag increase the granularity of the setting. One user could need to just overwrite a value, and leave the other meta tags to their default values. Doing as suggested, the user would have just the possibility to accept all the default values, or to change all the meta tags content.
    • Having a checkbox per meta tags allows to save the value of the checkbox together the meta tags content. Differently, the value of that setting should be saved in a different table, and I don't think it is really a good solution.
  • The settings are handled by each handler because only the handlers for the meta tags know what to do; just to make an example, the handler for the meta tag DC.DATE, when it is said to not overwrite the default value, will use the current timestamp as default value. Different handlers can use a different value, as it is done for the meta tag DC.CONTRIBUTOR, which uses the username of node author, when no default value has been set, and it is said to overwrite the default value.
avpaderno’s picture

StatusFileSize
new6.83 KB

I noticed that the previous commit contained errors (never trust the search/replace functionality, and never code when it is too late), and I fixed them. I also corrected how some meta tags content is generated.

hanoii’s picture

Just wondering if this was committed and if you should mark this issue as fixed.

avpaderno’s picture

Status: Needs work » Fixed

The code has been changed, and committed in the development snapshot for branch 6.x-3; if I didn't commit it on December 11, then I committed it on December 12.

Status: Fixed » Closed (fixed)

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