Drop Task: Add a link component to flexifilter module
| Project: | Flexifilter |
| Version: | 6.x-1.1-rc1 |
| Component: | Code - Components |
| Category: | task |
| Priority: | normal |
| Assigned: | cwgordon7 |
| Status: | needs work |
The flexifilter module is a powerful site-building tool. However, one thing that it's missing is a link component. Instead of using a link component, current flexifilters have to do complicated, slightly hackish stuff, such as prepending <a href="... etc. Instead, a link component would provide an easy, clean way of doing this.
Basic description:
Should be able to parse links in the form of either: link|title or title|link
Should not have "|" locked in as the divider; rather, it should be admin-specified.
Should be able to parse empty titles such as simply link into links such as <a href="link">link</a>
Should not attempt to make a link on an empty() link unless admin-specified.
Admin should be able to specify a prefix for the links; for example, http://en.wikipedia.org/wiki/
Deliverables:
A patch against flexifilter.components.inc.
Mentor:
cwgordon7

#1
#2
Patch fails agains 6.x-1.1-rc1:
$ patch -p0 < flexifilter_link_01.patch
patching file flexifilter.components.inc
Hunk #2 FAILED at 666.
Hunk #3 FAILED at 828.
2 out of 3 hunks FAILED -- saving rejects to file flexifilter.components.inc.rej
patching file flexifilter.flexifilters.inc
#3
Applicable to CVS HEAD, please.
#4
Minor bug:
The delimiter doesn't appear by default.
bigger bug:
original content
--------------
[[hello|hello]]
[hello|hello]
filtered content (appears as link)
--------------
hello]]
</p> <p>[hello|hello]</p>export
-------
a:8:{s:5:"label";s:4:"Test";s:11:"description";s:11:"just a test";s:2:"id";s:1:"2";s:7:"enabled";b:1;s:8:"advanced";b:0;s:5:"delta";s:1:"1";s:10:"components";a:3:{i:0;a:3:{s:5:"class";s:26:"flexifilter_link_component";s:8:"settings";a:6:{s:8:"ordering";s:1:"0";s:7:"divider";s:1:"|";s:8:"no_links";i:0;s:10:"check_path";i:0;s:6:"prefix";s:0:"";s:4:"step";s:7:"process";}s:2:"id";s:2:"94";}s:7:"id_next";i:95;s:9:"id_prefix";s:22:"flexifilter_component_";}s:3:"fid";s:3:"new";}
#5
You need to wrap it within a chunk grabber for anything useful to happen. What's happening here looks like a strange combination of a naive use of flexifilter with the line break filter.
#6
The minor bug is still there - "The delimiter doesn't appear by default" (i.e. I get a drupal error message "Divider field is required.")
#7
Another strange issue I get, although I must admit I'm still somewhere on the learning curve of this module :)
original preview:
this is a '''test'''
Component: Linkifier:
<a href="/D6/?q=this%20is%20a%20%3Cstrong%3Etest%3C/strong%3E">this is a <strong>test</strong></a>attached flexifilter export.
#8
Amitaibu, for #7: The double quotes around 'test' are apparently being used to give the text a bold layout using the HTML 'strong' tag. So another filter (flexifilter component?) is interfering here.
This is the explanation:
In URL encoding (used in the href), the html brackets < and > are encoded as %3C and %3E. In HTML encoding (used between the 'a' tags), they are encoded as < and >. Similarly, spaces are URL encoded as %20.
#9
Here is a modified version of the patch in #1 above.
Changes:
Still to investigate:
This component is now in use on an experimental Drupal install of mine, using the following filter:
a:9:{s:5:"label";s:9:"Wiki link";s:11:"description";s:67:"Transforms [links] into hyperlinks, supporting [alternative|names].";s:2:"id";s:2:"18";s:7:"enabled";b:1;s:8:"advanced";b:0;s:5:"delta";s:1:"0";s:5:"cache";s:1:"1";s:10:"components";a:3:{i:0;a:3:{s:5:"class";s:22:"flexifilter_chunk_grab";s:8:"settings";a:7:{s:6:"starts";s:1:"[";s:4:"ends";s:1:"]";s:11:"pass_limits";i:0;s:14:"case_sensitive";i:0;s:12:"include_rest";i:1;s:4:"step";s:7:"process";s:10:"components";a:1:{i:0;a:3:{s:5:"class";s:26:"flexifilter_link_component";s:8:"settings";a:7:{s:8:"ordering";s:1:"0";s:7:"divider";s:1:"|";s:8:"no_links";b:0;s:10:"check_path";i:1;s:16:"pathauto_cleanup";i:1;s:6:"prefix";s:5:"wiki/";s:4:"step";s:7:"process";}s:2:"id";s:2:"91";}}}s:2:"id";s:2:"89";}s:7:"id_next";i:92;s:9:"id_prefix";s:22:"flexifilter_component_";}s:3:"fid";s:3:"new";}