The social share url is now limited to 100 chars. When utilizing several undocumented but appearantly functional parameters for the facebook sharer.php the crafted url will be longer. To accommodate this I tried to added this line

#maxlength => 255

to the url-array in include/social_share.networks.inc at line 169. This does work as required. Now I can include longer strings. But the social share networks dialog is now a bit too wide. Didn't spend time to solve that - I'm rather new to Drupal coding.

To prevent my site from breaking when the social share module is updated without this addition, I created an additional module which adds the line to the array afterwards using the alter_form function. I don't know if this is the recommended approach.

CommentFileSizeAuthor
#2 fix_url_length-2106075-2.patch613 byteswillvincent
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

willvincent’s picture

The recommended method would be to create a patch, and post it here, so that it can be used be everyone else, and applied to the code in the repository.

See these links for more detail:

willvincent’s picture

Status: Active » Needs review
FileSize
613 bytes

Here is a patch.

Please review.

kscheirer’s picture

Version: 7.x-2.1 » 7.x-2.x-dev
Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

'#size' => 100 doesn't actually set the maximum string length, that's just the size to use when displaying the form element. See https://api.drupal.org/api/drupal/developer%21topics%21forms_api_referen....

However, the default maxlength is 128, so this patch definitely makes it bigger :) Looks like a decent patch to me, especially since the db storage is a blob more than capable of handling it. IE starts having problems with URLs over 2000 characters, so you might use that value instead.

oldenboom’s picture

Thanks for the patch. Tried it and the result is similar to my alter_form solution. So it works as expected. I consider this minor issue solved when applied to the trunk.

willvincent’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: -improv

  • willvincent committed 3729fd4 on 7.x-2.x
    Issue #2106075 by willvincent, oldenboom: Fix allowed url length.
    

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.