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.
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.
Comment | File | Size | Author |
---|---|---|---|
#9 | 2768731-9-social-share.patch | 437 bytes | dak5859 |
#6 | 2768731-6-social-share.patch | 561 bytes | Rajender Rajan |
#6 | interdiff.txt | 561 bytes | Rajender Rajan |
#2 | 2768731-1-social-share.patch | 429 bytes | dzinkevich |
Comments
Comment #2
dzinkevich CreditAttribution: dzinkevich at Zivtech commentedHere's a patch:
Comment #3
dak5859 CreditAttribution: dak5859 commented@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,
);
}
Comment #4
dzinkevich CreditAttribution: dzinkevich at Zivtech commented@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.
Comment #5
dak5859 CreditAttribution: dak5859 commented@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.
Comment #6
Rajender Rajan CreditAttribution: Rajender Rajan as a volunteer commentedThe property 'region' is an optional. Therefore, this property can be removed so that it has no region defined by default.
Comment #7
Rajender Rajan CreditAttribution: Rajender Rajan as a volunteer commentedComment #8
keshavv CreditAttribution: keshavv commented#6 working fine for me . thanks
Comment #9
dak5859 CreditAttribution: dak5859 commentedAfter 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.
Comment #10
dak5859 CreditAttribution: dak5859 commentedJust to confirm. With my patch changes I was able to successfully apply this patch. Thanks all for leading me in the right direction.
Comment #11
Rajender Rajan CreditAttribution: Rajender Rajan as a volunteer and at gai Technologies Pvt Ltd for gai Technologies Pvt Ltd commented