When I go to "Create a new hotblock" (the link that is visible in the block as an icon), in the thickbox popup, in the table list of actions, I see my content type, which I've designated as a content type that should be usable in hotblocks -- that's great no problem so far. The content type i created and told hotblocks to use is called a "Quicklink" and the terminology i've defined is quicklink, so as expected I see:
Create "Quicklink" quicklink
What's odd, however, is that under it I'm seeing:
Create "" quicklink
So I have 2 table rows:
Create "Quicklink" quicklink
Create "" quicklink
The second row goes to the generic "node/add" page, because there's a malformed url in the href of the link.
I found the issue in function hotblocks_create_for_block($iDelta)
hotblocks_get_types() returns:
Array
(
[quicklink] => quicklink
[0] => block
)
That second item in there, block, is what's adding the extra row.
by changing:
foreach (hotblocks_get_types() as $sType) {
$aInfo = content_types($sType);
if(node_access('create', array('type' => $aInfo['type'])) && hotblocks_access('create items in any hotblock', $sType, $iDelta)) {
$aRows[] = array( l(t('Create "') . $aInfo['name'] . '" '.hotblocks_terminology(), 'node/add/' . $aInfo['url_str'] . '/hotblocks_item/'.$iDelta, array('query' => drupal_get_destination() . '&path=' . $_GET['path'], 'attributes' => array('class' => 'hotblocks_item-create'))));
}
}
to
foreach (hotblocks_get_types() as $sType) {
$aInfo = content_types($sType);
if(node_access('create', array('type' => $aInfo['type'])) && hotblocks_access('create items in any hotblock', $sType, $iDelta) && !empty($aInfo['name']) {
$aRows[] = array( l(t('Create "') . $aInfo['name'] . '" '.hotblocks_terminology(), 'node/add/' . $aInfo['url_str'] . '/hotblocks_item/'.$iDelta, array('query' => drupal_get_destination() . '&path=' . $_GET['path'], 'attributes' => array('class' => 'hotblocks_item-create'))));
}
}
notice the && !empty($aInfo['name'] addition to the if statement in the foreach() -- that eliminates the extra row.
Is this a bad idea to do this?
Comments
Comment #1
justindodge commentedApologies, but I essentially stopped reading after you said
To be sure, a better job could be done to prevent this sort of idiosyncrasy, but the settings you have on the config page contradict each other - that is to say, there is no purpose of "allowing other drupal blocks to be inserted..." if you are then going to exclude every single module's blocks.
The best course of action would be simply to uncheck the option that allows blocks to be inserted. If in fact you do wish blocks to be inserted, you will need to allow at least one module's blocks to be in the list, lest you find this ghost item in the array.
Let me know if this resolves your issue.
Comment #2
tmsimont commentedhaha i don't blame you.
i should have removed that part of the issue description, however, because i actually removed the contradiction in the settings and the problem persists. sorry it's kind of a oversized dump of my thoughts without much filtering, i've been rushing through a project where i'm using this module and i know you're attentive to issues so i'm just trying to quickly spit it all out.
if you go back and read on, disregard that note about the settings contradiction, as i've encountered the problem with and without it -- i've actually suggested a potential fix, but i wonder if it's going to cause problems down the road. i'd think not, check it out.
Comment #2.0
tmsimont commentedtypo correction
Comment #2.1
tmsimont commentedeliminated confusing extra information that wasn't relevant to the problem
Comment #3
tmsimont commentedi cleaned it up a little bit and dropped that part of the issue
Comment #4
justindodge commentedAh! I've taken another look and I see what the problem is. I confused myself for a moment by thinking you were on the assign page, rather than create, in which case 'block' should be eliminated entirely because creating a new block and assigning it directly to a hotblock via the hotblocks UI is not supported.
I think your modification suffices, I will commit it to the dev branch tomorrow.
Comment #5
justindodge commentedCommitted to dev
Comment #6
justindodge commentedComment #7
justindodge commentedReleased in 6.x-1.7
Comment #8.0
(not verified) commentedmore description