Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There is the great new feature "Overrides per node" with "Available as block".
It would be great that on creating a node, where you can choose to provide a block on per node level,
this option was turned off as default. This way blocks are only created as an opt in, where there are needed.
This appears to me more logical from design.
By Coding simply change the default value from TRUE to FALSE in Line 186 in nodeblock.module like here
$form['nodeblock']['enabled'] = array(
'#type' => 'checkbox',
'#default_value' => isset($node->nodeblock) ? $node->nodeblock['enabled'] : FALSE,
'#required' => FALSE,
'#title' => t('Create a block for this node'),
'#description' => t('Should a block be created for this node?'),
);
Comment | File | Size | Author |
---|---|---|---|
#6 | 2072427-default-on-off-6.patch | 4.09 KB | legolasbo |
Comments
Comment #1
klonosI on the other hand find it useful to have it the other way around: default to be turned on and have users opt-out. So, how about we settle for having a Default behavior drop-down menu that appears conditionally (only when the Available as block option is checked) and it provides two options: on/off?
Comment #2
klonos...alternatively, it could be a single drop-down with these three options:
- Disable
- Enable, default to on
- Enable, default to off
Comment #3
Johnny vd Laar CreditAttribution: Johnny vd Laar commentedI think #2 is a good solution. I'll add this when I find time.
Comment #4
klonosI'm stupid.
Moved my comment to a separate issue: #2082997: The "Provide a block title" option (when allowed to override the block title) is inconsistent - It should be on by default.
Comment #5
legolasboNo need to find time Johnny, attached patch adds the mentioned solution.
Comment #6
legolasboI just realised I haven't updated hook_uninstall to remove the newly added variable. While adding a line to remove it, I also discovered that the original overrides variable wasn't being removed either. Attached patch fixes both issues aswell.
Comment #7
TechNikh CreditAttribution: TechNikh commentedPatch in #6 works for me. Thanks legolasbo
Comment #9
Johnny vd Laar CreditAttribution: Johnny vd Laar at ezCompany commentedI've modified your patch a little bit, if you where using the patch then you'll need to resave the content types because the dropdown has different values. I kept the checkbox because of backwards compatibility and I added some states.
http://cgit.drupalcode.org/nodeblock/commit/?id=a38d5c3
Thanks for the work!