I was playing around with using SM in blocks only with no content types selected in the SM Admin area. The blocks would not display. The block would only display if a content type (page for example) is set. Then both above/below SM would appear in addition to the block. Not independent like I would expect. I changed a function in the module and the change looks to fix that issue. Granted if you have a content type selected and a block enabled, both display as expected. But the blocks now display when no content types are selected.
Old Function
function _sexybookmarks_display($settings, $node, $type) {
if ($settings['display']['types'][$node->type] !== 0) {
// Display in node.
if ((isset($settings['display']['location']['above']) && $settings['display']['location']['above'] != FALSE) || (isset($settings['display']['location']['below']) && $settings['display']['location']['below'] != FALSE)) {
// Display in teaser.
if (isset($type['teaser']) && $type['teaser'] && $settings['display']['node'] != 1) {
return TRUE;
}
// Display in page.
if (isset($type['page']) && $type['page'] && $settings['display']['node'] != 0) {
return TRUE;
}
}
// Display in block.
if (isset($type['block']) && $type['block']) {
return TRUE;
}
}
return FALSE;
}
New Function
function _sexybookmarks_display($settings, $node, $type) {
if ($settings['display']['types'][$node->type] !== 0) {
// Display in node.
if ((isset($settings['display']['location']['above']) && $settings['display']['location']['above'] != FALSE) || (isset($settings['display']['location']['below']) && $settings['display']['location']['below'] != FALSE)) {
// Display in teaser.
if (isset($type['teaser']) && $type['teaser'] && $settings['display']['node'] != 1) {
return TRUE;
}
// Display in page.
if (isset($type['page']) && $type['page'] && $settings['display']['node'] != 0) {
return TRUE;
}
if (isset($type['block']) && $type['block'] != FALSE) {
return TRUE;
}
}
}
else {
// Display in block.
if (isset($type['block']) && $type['block'] != FALSE) {
return TRUE;
}
else return FALSE;
}
}
Note the initial if statement is checking to see if there are any content types selected. When using SM in a block, there really is no need for content type (IMO). The patch I'm using will allow it, but places the blocks statements in the else portion to fix display issues. I'm sure there is probably a more elegant way and if you have it please share ;)
Steps to recreate issue:
1. SexyBookmarks admin area, ensure no Content Types are selected.
2. In Blocks admin area select the SexyBookmarks block and place in a region of your choice.
Comments
Comment #1
Anonymous (not verified) commentedThis fixes the problem when working with panels. It is the same problem I guess. You can SM on a panels node by adding it from the list in Miscellaneous, which is the block version of SM. When in SM admin panels content type isn't checked then SM won't show, but when it's checked then SM will show in panels and also above or below content ( depending which option is set ).
With this fix, panels content type isn't checked, but still can place SM wherever I want on a panels page.
Thanks for this. Hope this is in the next release included.
Comment #2
decipheredThe integration methods in 6.x-2.x (blocks, node pseudo field) have been greatly improved and this issue should no longer be an issue.
Cheers,
Deciphered.