diff -r1.1 simplify_node_add.module
34a35
> case 'notifications':
90a92
> 'notifications' => t('Notification settings'),
113c115
< }
\ No newline at end of file
---
> }

Comments

boran’s picture

Organic groups notification can also be hidden simply this way too:

diff -r1.1 simplify_node_add.module
34a35,38
> case 'og_register':
> case 'notifications':
90a95,97
> 'og_register' => t('OG register'),
> 'notifications' => t('Notification settings'),

Hmm. Would also have been nice to only display a module in the list, if that module is enabled...

fabianderijk’s picture

Assigned: Unassigned » fabianderijk

The module list is actually a god idea as a addition to the drupal core standard form elements. I think I can do something with it. As soon s there is some time i will take a look at it.

boran’s picture

I tried to add the following around line 110, to add another key to the options array if the notifications module is installed

  foreach (module_list(FALSE, FALSE) as $module) {
    if ($module=='notifications') {
       $form['simplify_node_add_fieldset_' . $type->type]['simplify_node_add_' . $type->type] ['#options'] [] = 'notifications' => t('Notification settings');
    }
  }

But Php complains: unexpected T_DOUBLE_ARROW

fabianderijk’s picture

Isn't the correct code:

foreach (module_list(FALSE, FALSE) as $module) {
    if ($module=='notifications') {
       $form['simplify_node_add_fieldset_' . $type->type]['simplify_node_add_' . $type->type] ['#options'] [] = array('notifications' => t('Notification settings'));
    }
  }

Hence the addition of array around "'notifications' => t('Notification settings'"

boran’s picture

Yes that make sense.. now there is no php error but a new entry is added called "array". Hmm.

fabianderijk’s picture

I will see if i can make a dev version of the module where the options are placed in a variable where you can easily add options.

fabianderijk’s picture

the dev version is commited, it will be online after it's rebuild at night.

boran’s picture

After installing the dev from 19th feb, I don't see the difference, at least not in the GUI.
In the code I don't see any reference to notifications, what variable do you mean?

fabianderijk’s picture

On line 84 of the module the array $field_types is started. In here you can add your own field you want to exclude on the node add or node edit page. Be sure to also add the field to the switch in the simplify_node_add_form_alter function. I will extend the hook the next coming days so you don't have to hack the module any more.

boran’s picture

The patch in #1 above is what was done last time.
I was hoping you could include #1 and #4 so we could start covering the fields of several non core, but frequently used, modules out of the box.

fabianderijk’s picture

Hi Boran,

I will see what I can do. The problem with non-core modules is that I don't know where to draw the line if it's frequently used. That's why I want to extend the hook so people can use it to hide the fields of non-core modules and only support core modules natively. But I'm open for suggestions and try to make up a list with non-core, but frequently used modules and try to implement it in the module.

In the coming nightly build there will be options for notifications and organic groups.

boran’s picture

I understand you concerns. simplify_node_add_form_alter() is called on each node add/edit, so it needs to be kept as lightweight as possible too.

I tested the dev release (24th feb), very nice!

One issue:
In simplify_node_add_settings(), og_register should be moved to the section "if(module_exists('og'))".

There was a line added:
if($form['#id'] == 'node-form')
what is that for? To ensure there is no processing on form other than node add/edit and thus improve performance?

FYI I also tested it with Vertical tabs, which also improves the user experience. There was no conflict.
BTW if you are still looking for a co-maintainer, I'd be interested in helping. Tell me what you need/expect.

fabianderijk’s picture

Thanks for the compliments and testing. It would be nice if someone would help me co-maintain this module. If you would like to apply then it's OK with me! About the issue, it's fixed now, and will be available after the next nightly build.

The line "if($form['#id'] == 'node-form')" that was added in the latest version is indeed to check if the form processed is the form to add or edit the node. It isn't a necessary addition, but it will improve performance.

When you apply for a cvs account you can link to this issue to let drupal know that you have my approval as co-maintainer.

avpaderno’s picture

Title: patch to enable the notification section (if the notification module is installed..) » Patch to enable the notification section (if the notification module is installed..)

FYI, I approved boran's application, to whom I granted access to this project repository.

fabianderijk’s picture

Status: Active » Fixed

This was fixed in the latest dev release

Status: Fixed » Closed (fixed)

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