I hope it's not a duplicated issue.. Couldn't find any similiar question in the issues list.
Is there possibility to set this field only for external links ?
E.g. to validate if link format is correct. Now when I put 'asd' it creates a link http://localhost/asd .
I want to disable it and force user to put proper link , like 'example.com' instad of 'example'...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jcfiala’s picture

Hmm. It's not a current issue, but I can certainly see the use in forcing the type of link.

Of course, it would get done quicker if someone could work up a patch!

benone’s picture

By now I just changed line 727

  if (preg_match($internal_pattern . $end, $text)) {
    return LINK_INTERNAL;
  }

to

  if (preg_match($internal_pattern . $end, $text)) {
    return FALSE;
  }

Works. :)

wik’s picture

subscribing

wik’s picture

Issue tags: +external URL, +absolute

some tags

nasa51’s picture

Version: 6.x-2.8 » master
FileSize
1.83 KB
1.91 KB

Add option on link field setting for "DO NOT accept local links"

benone’s picture

is it comitted in 6.x-2.9 ?

benone’s picture

valid_url function is poor
when i put http://aaa it takes it true , but when I type www.aaa.com it shouts at me with the error.
What a pity...

gooddesignusa’s picture

subscribing. Any chance on a re roll for the latest dev?

fourmi4x’s picture

I'm so suscribing to this!

There are already two other threads about that topic :
http://drupal.org/node/863396
http://drupal.org/node/831980

It would be awesome to be able to choose for each Link field if we want to accept only internal, only external or both types of links.

Apparently the patch in #5 has not been committed... ?

dqd’s picture

The reason for why there's been no patch submitted is obvious: it is a one-way solution which can't be submitted easely to a modul in a MODULAR system with many use cases. Think about a multi-domain Drupal installation, which wants to except internal links for all including domains - Just to count one example. I think this specific feature request will not find its place in this module, as along as there is no better suggestion for a general purpose which can handle this and more than one use case, to prevent goose-chases afterwards.

I darsay, or what I rather could imagine is a pattern field which can be optionally switched between "except only the pattern" or "expect all but not this pattern" (similar to what blocks support). But this will rather be a feature request for a link 7.x 2.0 release. For link 6.x and 7.x 1.0 we have already a code freeze: read here why -> #1269718: Blockers to a 7.x-1.0 release?

Feel free to provide patches here for 7.x 2.x but it will sadly rather committed when 1.0 is finally out. Thx 4 understanding.

gooddesignusa’s picture

Can we copy the pattern match from http://drupal.org/project/extlink.
Would this work?
screen shot of extlink settings page attached

dqd’s picture

Version: 7.x-1.x-dev » master
Status: Closed (duplicate) » Active

Folks, please read the project page info of link module carefully. There is already an issue to collect and discuss all possible validation scenarios in general. That's why I will mark this one here as a duplicate. I need all concentration inside the ONE and only discussion to move forward. After a D7 implementation we will provide a D6 backport.

Explanation: There are too many corner cases and validation wishes of users to implement them all serially one after the other. We would have a 40 lines cluttered settings form for validation methods only conflicting each other. I think, the right way is to find a maybe more complex but all embracing configuration method, which lets the admin better decide how and when to validate the url. Including a good description which helps to set it up.

#11, good point! didn't even knew it. But it'S funny that it fits to what I sad on the gathered issue on this topic.

dqd’s picture

Version: master » 7.x-1.x-dev
Status: Active » Closed (duplicate)
dqd’s picture

Version: master » 7.x-1.x-dev
Component: User interface » Code
Status: Active » Closed (duplicate)
Issue tags: -external URL, -absolute +field validation

it's rather code component and needs a better tagging to sort issues for field validation