Problem/Motivation

When enabling the social share block, it appears in the content region by default. For themes that are using this block in a panel, this causes the block to appear twice on the page on deployment. Realistically, the current behavior might be fine for 99% of users but for our use case, we can't be automatically adding it to the content region.

Proposed resolution

Users should be allowed to decide for themselves which region this appears in.

Remaining tasks

I will post a patch shortly to resolve this.

User interface changes

The block will appear unded -None- by default instead of the content region.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dzinkevich created an issue. See original summary.

dzinkevich’s picture

FileSize
429 bytes

Here's a patch:

dak5859’s picture

@dzinkevich. I don't see any difference in this patch and the code it's supposed to replace in that social_share.module file for version 7.x-2.3. Are you sure this worked for you or you're not missing something here? I see the current code as (see below). So how is your patch changing anything? It looks as though its actually missing the array part of this code.

/**
* Implements hook_block_info().
*/
function social_share_block_info() {
$blocks = array();
if (variable_get('social_share_block', 0)) {
$blocks['social_share'] = array(
'info' => t('Social Share'),
'visibility' => 0,
'status' => TRUE,
'region' => 'content',
'weight' => 99,
'cache' => DRUPAL_NO_CACHE,
);
}

dzinkevich’s picture

@dak5859 A patch file doesn't include the whole file, just the changes. I am quite sure that this works as it has been successfully deployed. If you look at the patch file, all it does is remove the default region of the block (line 138).

Please review https://www.drupal.org/patch/apply for direction on applying this patch.

dak5859’s picture

@dzinkevich. Thanks for the clarification on the code in that patch. I guess I'm still missing something. I understand this patch doesn't include the entire file contents of the .module file, and just the changes, but if that's the case, then what are the changes? I'm seeing that exact same code in that portion of the .module file after downloading a fresh copy of the project (v7.x-2.3). Has this module already been updated with this patch? Line 138 in the .module file says, "'weight' => 99," - is that where you're saying it's removing the default region of the block? I would think that would be this reference: 'region' => 'content', And I'm not sure how the patch is removing anything there.

Rajender Rajan’s picture

FileSize
561 bytes
561 bytes

The property 'region' is an optional. Therefore, this property can be removed so that it has no region defined by default.

Rajender Rajan’s picture

Status: Active » Needs review
keshavv’s picture

#6 working fine for me . thanks

dak5859’s picture

FileSize
437 bytes

After further review of these patch examples (that are working for you and not me) I noticed the paths to the Social Share module directory in these patches are both different than the path we're using in our environment. That seems to be causing the problem I'm having applying the patch. I'm resubmitting this patch with the path relative to just the module directory to see if that helps.

dak5859’s picture

Just to confirm. With my patch changes I was able to successfully apply this patch. Thanks all for leading me in the right direction.

Rajender Rajan’s picture

  • blacksnipe committed 82265fd on 7.x-2.x
    Issue #2768731 by Rajender Rajan, dzinkevich, dak5859: Block should not...