Now webform_node_types store all enabled content type in a single array, so difficult to use features to manage it per individual content type.

Similar as diff_form_node_type_form_alter, we can move the enabled content type from admin/config/content/webform to admin/structure/types/manage/*, so replace webform_node_types as webform_node_* per content type.

P.S. Related patch files for other projects:

All similar 3rd party modules patch with same idea as this issue:

Comments

hswong3i’s picture

Status: Active » Needs review
StatusFileSize
new12.78 KB
quicksketch’s picture

Hi @hswong3i, thanks for the patch!

I think splitting up the variable into separate ones is a good idea. It makes it easier to manage via features this way. However, I'm on the fence about putting the Webform-enabled setting on the individual content type forms, as I mentioned in this very similar issue: #1963870: Expose Webform settings in content type form .

Instead of having two issues for the same thing, could you review that patch and merge in your different changes (if any) into it?

hswong3i’s picture

StatusFileSize
new22.73 KB

Update since #1:

  • Merge the js for node_type_form from #1963870: Expose Webform settings in content type form
  • Fix lots of typo and logic mistake
  • Clean up some tailing white spacing
  • Update the help message that guide user to content type administration page for enable webform per content type

P.S. I don't think we should merge all progress from #1963870: Expose Webform settings in content type form because that issue suggest a duplication of enable/disable webform per content type on multiple pages, which may confluse end user.

berliner’s picture

Status: Needs review » Needs work

@hswong3i: Your second patch file contains distinct consecutive diffs. That makes it unnecessary difficult to follow the changes.

hswong3i’s picture

Status: Needs work » Needs review
StatusFileSize
new18.15 KB

As per requested, detail commit history goes to https://github.com/pantarei/drupal-webform/tree/7.x-4.x-2062235 ;-)

hswong3i’s picture

StatusFileSize
new18.09 KB

Changeset goes to https://github.com/pantarei/drupal-webform/commit/5a6954d43b5de5e05c5a87..., include:

  • Simplify vertical tab at content type form implementation

Up to this point I have already consolidate all similar 3rd party modules patch with same idea into this issue:

Final patch attached already applied to DruStack for more than a week, and perfectly handle my initial request on this issue with numbers of client's project:

Now webform_node_types store all enabled content type in a single array, so difficult to use features to manage it per individual content type.

Please feel free to improve this issue according to overall project design concern (which always a weakness for a contributor besides original author), and it is my pleasure to remove the manual patch within distribution once changes goes into mainstream. Thank you very much and looking for any good news ;-)

barraponto’s picture

I generally agree with the ideas presented on this issue, I'll review the patch as soon as I can (no sooner).

quicksketch’s picture

Status: Needs review » Needs work

While testing this out I found a significant flaw in the update hook:

$types = array_keys(array_filter(variable_get('webform_node_types', array('webform')))

This will always produce a non-sensical array that uses the numeric keys as the values. i.e. array(0, 1, 2). I think it should just be:

$types = variable_get('webform_node_types', array('webform'));
quicksketch’s picture

Status: Needs work » Needs review
StatusFileSize
new17.63 KB

This patch updates the update hook and makes the Vertical Tabs integration a little more explicit. It now says "Disabled" if the checkbox for enabling Webform isn't enabled.

quicksketch’s picture

StatusFileSize
new17.61 KB

One more change. I made webform_node_types() return an unkeyed array, rather than keying by content type. That makes it consistent with the previous variable by the same name. $key => $key arrays always seem unnecessary to me.

hswong3i’s picture

@quicksketch: seems missed out the js/node-type-form.js from #10?

quicksketch’s picture

Status: Needs review » Needs work

@quicksketch: seems missed out the js/node-type-form.js from #10?

Ah, yes most likely. I made some changes to that file too. I'll reroll tomorrow.

quicksketch’s picture

Issue summary: View changes

Add related project patch links

quicksketch’s picture

I'll reroll tomorrow.

Well I'll reroll it soon at least. :P

quicksketch’s picture

Status: Needs work » Needs review
StatusFileSize
new19.61 KB

Here's the patch with the node-type-form.js file included.

quicksketch’s picture

Status: Needs review » Fixed

Well, even though I'm not particularly a fan of this approach, an informal survey of my peers resulted in everyone thinking it made sense to move the settings. I can't find any problems with the patch and everything works for me, so I've committed it to the 7.x-4.x branch.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

Add more reference links