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.
Attached is a patch which makes link-fields supported by the entity property API as introduced by the entity API module. This makes link fields accessible in Rules and any other module relying on that, e.g. search api.
patch attached.
Comment | File | Size | Author |
---|---|---|---|
#11 | 1079782-link-entity-property.patch | 2.35 KB | klausi |
#7 | 1079782-link-entity_property-7.patch | 2.38 KB | drunken monkey |
#2 | 1079782-link-entity_property.patch | 2.37 KB | klausi |
#1 | link_entity_property.patch | 2.43 KB | fago |
link_entity_property.patch | 2.43 KB | fago | |
Comments
Comment #1
fagoand the same patch with -p0
Comment #2
klausiPatch does not apply anymore, new one attached.
Comment #3
dasjoworks for me.
usage example:
Comment #4
pfrenssenAwesome work!!
For completeness, can you please support the 'description' element in the link_field_item_property_info() properties?
Comment #5
fagoThe default callback run by the entity API entity_metadata_field_default_property_callback() already takes care of generating a description, so the patch should be fine as is. Thus, setting back to RTBC.
Edit: Realizing you talked about the nested properties. They already have a label which I think say already everything, or what would you suggest to add as description? Anyway, descriptions are not mandatory.
Comment #6
jcfiala CreditAttribution: jcfiala commentedHm. There's two basic things I need to accept this patch.
1) As best as I can see from looking over the patch, this patch adds support for the 'title' and 'url' parts of the field, but _not_ for the 'attributes' part. I don't think that's a good idea.
2) I'm totally unfamiliar with the Entitly API module, and I'd rather not enter in this functionality without coming up with some sort of simpletest that tests the code. But I don't know enough on how to create a simpletest - I need either some tests, or a suggestion of how to build a test.
Thanks!
Comment #7
drunken monkeyPatch doesn't apply anymore, attached is a re-roll (but yet without taking the comments in #6 into account).
Comment #8
Anonymous (not verified) CreditAttribution: Anonymous commentedI was just looking at whether Entity Property API support was in Link module because I want to add microdata... here's the issue #1267662: Support microdata in link
Comment #9
pfrenssen#5 Posted by fago on May 3, 2011 at 9:52am
It's true, the descriptions are not mandatory, but as they are shown in certain forms (such as Search API) it is nice to have.
Comment #10
scor CreditAttribution: scor commentedThanks for the patch. I can confirm it does work and we're working on leveraging this functionality in RDF as well: #1273450: Support for link field in the RDF model
Comment #11
klausidoes not apply anymore, reroll.
Comment #12
dqdthx 2 all! I am about to catch up link issue queue. I will commit immediately to prevent another reroll ...
Comment #13
dqdComment #14
klausiDrupal coding standards: "All text files should end in a single newline (\n). This avoids the verbose "\ No newline at end of file" patch warning and makes patches easier to read since it's clearer what is being changed when lines are added to the end of a file." http://drupal.org/node/318#indenting
Should be good, no? Check your git settings.
Comment #15
dqddoesn't matter.
It has created a new empty line @ link.module but I simply removed it and bam ..
committed to latest dev now with your credentials :-P
thx 2 all!++
Comment #17
j0rd CreditAttribution: j0rd commentedThis patch doesn't allow for easy field creation of links.
$wrapper = entity_metadata_wrapper("node", $node);
// Fails a horrible death
$wrapper->field_link = 'http://google.com';
// Works
$wrapper->field_link = array('url' => 'http://google.com', 'title' => '');
Ideally the former would work. Just my 2cents from running into this problem. Posted here for others looking for solution.
Comment #18
tim.plunkettExpanded this for attribute support: #2117099: Expose attributes as property info