Hello, when I add a Rel-Attribute to my field, wich I created with CCK and Link, I can't see it in my source code :(

CommentFileSizeAuthor
#11 Website edit settings.jpg157.96 KBkerberos
#5 Link.jpg159.55 KBkerberos

Comments

kerberos’s picture

Category: support » bug

Yeah, I am experiencing the same issue. I am using it without a title and with the 'Open link in new window' option in a multiple value field.

jcfiala’s picture

Try the dev version instead of 6.x-2.8.

kerberos’s picture

I just tried it with the dev from Jan 19, still nothing.

For the CCK link field, the configuration is set as:

Rel Attribute:
rel = "nofollow"

and also a custom CSS class. This is the relevant output in the page source:

<div class="field field-type-link field-field-website">
    <div class="field-items">
            <div class="field-item odd">
                      <div class="field-label-inline-first">
              Website:&nbsp;</div>
                    <a href="http://www.casavictor.ro/ro/" target="_blank">http://www.casavictor.ro/ro/</a>        </div>
        </div>
</div>

No rel or CSS. The target is properly applied though.

jcfiala’s picture

Version: 6.x-2.8 » 6.x-2.x-dev
Assigned: Unassigned » jcfiala

Okay, this is really useful.

Would you please go into the form where you're configuring this link field, review that the settings are what you're expecting, and then hit the 'save field settings' button? And then, go back and re-test that this is still failing?

kerberos’s picture

StatusFileSize
new159.55 KB

We initially imported that content type from another site, so I thought that might be an issue as well and tried it in the past already. I retried it based on your message by changing the settings to something else, saving, examining the page source, changing them back, saving again and checking again. After each save, I did a cache clear (even though all caching is disabled on this dev site). The problem persisted, nothing changed in the page source. I've attached the second set of settings in case it helps.

We had the same issue on the original site with the original content type (using 2.8, not dev).

jcfiala’s picture

Okay, good - this is great info for me to work with. If it's persisting after you've re-saved the field, then that means it's probably not a data issue. I'll try and pound on this a bit this weekend. This is one of the issues I consider holding up the 2.9 release, because I want to get this done!

kerberos’s picture

Let me know if I can do anything else to help you catch this. Thanks,

-Daniel

jcfiala’s picture

Okay - I need a bit more information. Can you do a query on content_node_field for the field_name that you're having trouble with? I'm just not quite getting this working yet.

kerberos’s picture

I'm not sure if you are looking for anything in particular, but the column 'field_website_attributes' looks like:

a:3:{s:6:"target";s:7:"default";s:5:"class";s:0:"";s:3:"rel";s:0:"";}

jcfiala’s picture

Wow.

That's the serialized form of:

array(
  'target' => 'default',
  'class' => '',
  'rel' => '',
);

Which would produce exactly the results you're seeing. How *very* odd - the rest of the code is working fine, but your data is messed up somehow. What do you see when you go in to edit the field, before you make any changes?

kerberos’s picture

StatusFileSize
new157.96 KB

Here's a picture of the settings I see when I go to the edit form. When I edit and save, they save successfully (I mean the changed values are there when I edit again).

-Daniel

kerberos’s picture

Btw, I got the serialized field settings data above from PHPMyAdmin. Did you want me to get it in another way?

-Daniel

jcfiala’s picture

Well, that's just deeply weird. The data in the database says x, y, and z, and the data in the form says a, b, and c.

Are you absolutely sure you're looking at the same field in both places? No situation where one is the dev database and the other is production, or something like that? I won't have the time for a few days to poke through the code again, so I won't be able to follow up this information until then.

kerberos’s picture

Yeah, I am looking at the table 'content_field_[fieldname]' (website for this field) for the Web site with those settings I sent earlier. There is no production site yet, just dev. It's 100% the same site. I can't really explain it either, unless the module saves it somewhere else as well? I checked the other site with the same problem as well, it has the same data for the attributes.

-Daniel

halloffame’s picture

Guys I'm experiencing the same problem. I have my nofollow links for some time now and I'm surprise to find out that all nofollow attribute created with the cck link field does not render.

benjamin.pauley’s picture

Subscribing. (Sorry not to have anything to add beyond that...)

kerberos’s picture

John, let me know if I can assist you in finding the cause in some way.

-Daniel

benjamin.pauley’s picture

Just thought I'd report: I downloaded the latest dev version (Jan. 28) to a local copy of my site. The rel and CSS classes are turning up correctly with that version.
-bp

sk33lz’s picture

Hi,

Although this seems to be possibly fixed in a simple view with the latest dev version, I have a bit more complex view that I am building with custom outputs and using replacement patterns.

I am using the option of Rewrite the output of this field, Output field as a link, and I am using a replacement pattern in the link path of [field_feedurl_url], but with this combination I get no rel="nofollow" attribute in my view output. Same problem as above.

I do however get a rel="nofollow" on the node view that I created, so it is working on that CCK field in that view.

Hopefully the information I have provided can help track down the bug.

Thanks

mcurry’s picture

subscribe

copyhold’s picture

Version: 6.x-2.x-dev » 6.x-2.8
Component: Miscellaneous » Code

subscribe

and in my case putting `nofollow` into `rel` field leads to error message.

preg_match() expects parameter 2 to be string, array given in /var/www/m-----.com/includes/bootstrap.inc on line 777.

debug shows that element generates attributes array in a wrong way

'attributes'=>array(
  'rel'=>array(
    'rel'=>'',
    'class'=>''
  )
);

leaving the rel field empty supresses the error

jcfiala’s picture

Status: Active » Postponed (maintainer needs more info)

Okay, folks, I've just committed a fix to #628902: warning: preg_match() expects parameter 2 to be string which had to do with a problem with rel attributes. Could folks who have been having this problem upgrade to the latest version of 6.x-2.x-dev link module tomorrow (2/22) and let me know if this fixes their problem? I know for sure it's fixed the issue in #21, as that's what the linked issue was for.

Keep in mind that if the link points to an internal page on the same site, then the link won't have rel="nofollow" attached.

If people are still having a problem with the updated link tomorrow, let me know and I'll get back on this.

yaworsk’s picture

I was having the same issue with 6.x-2.8 - no rel or class associated with the links. Upgraded to 6.x-2.x dev and it is working now.

Thanks for the help.
Pete

spookypld’s picture

100% agreement, development version fixed this on my site 2.

jcfiala’s picture

Version: 6.x-2.8 » 6.x-2.x-dev
Status: Postponed (maintainer needs more info) » Fixed

Okay, I'm going to provisionally move this to fixed, with the proviso that currently it's only fixed in the -dev version. I'm going to try and get out a beta version this weekend, but things are looking very good.

And then I can get started on the D7 version. Woot!

romanellom’s picture

fixed at the moment:

edit link.module

row 385

if ($type != LINK_EXTERNAL && strpos($item['attributes']['rel'], 'nofollow') !== FALSE) {
    $item['attributes']['rel'] = str_replace('nofollow', '', $item['attributes']);
  }

on

if ($type != LINK_EXTERNAL && strpos($item['attributes']['rel'], 'nofollow') !== FALSE) {
    $item['attributes']['rel'] = str_replace('nofollow', '', $item['attributes']);
  }else{
	$item['attributes']['rel'] = $field['attributes']['rel'];
	}

Status: Fixed » Closed (fixed)

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

mpisano’s picture

Status: Closed (fixed) » Fixed

#26
Works fine, but in version 6.x-2.x-dev is in the row 420

Status: Fixed » Closed (fixed)

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

elijah lynn’s picture

Is this in 6.x-2.9? I didn't see this issue referenced on this release notes page --> http://drupal.org/node/827200

jcfiala’s picture

It should be. I may have not properly copy/pasted all of the changes over.