The formatters override the default formaters, implying that all links have to go through shrinktheweb. However, in our use case, we only wanted some links to have the preview.
I have modified the hook_field_formatter_info() (see below) to prepend "stw_" to each formatter so that they don't override the default formatters, instead adding new formatters.
/**
* Implementation of hook_field_formatter_info().
*/
function shrinktheweb_field_formatter_info() {
return array(
// -- Link module ----------------------------
'stw_link_default' => array(
'label' => t('[ShrinkTheWeb] Title, as link'),
'field types' => array('link_field'),
'multiple values' => FIELD_BEHAVIOR_DEFAULT,
),
'stw_link_url' => array(
'label' => t('[ShrinkTheWeb] URL, as link'),
'field types' => array('link_field'),
'multiple values' => FIELD_BEHAVIOR_DEFAULT,
),
'stw_link_plain' => array(
'label' => t('[ShrinkTheWeb] URL, as plain text'),
'field types' => array('link_field'),
'multiple values' => FIELD_BEHAVIOR_DEFAULT,
),
'stw_link_short' => array(
'label' => t('[ShrinkTheWeb] Short, as link with title "Link"'),
'field types' => array('link_field'),
'multiple values' => FIELD_BEHAVIOR_DEFAULT,
),
'stw_link_label' => array(
'label' => t('[ShrinkTheWeb] Label, as link with label as title'),
'field types' => array('link_field'),
'multiple values' => FIELD_BEHAVIOR_DEFAULT,
),
'stw_link_separate' => array(
'label' => t('[ShrinkTheWeb] Separate title and URL'),
'field types' => array('link_field'),
'multiple values' => FIELD_BEHAVIOR_DEFAULT,
),
);
}
Comments
Comment #1
Anonymous (not verified) commentedProviding a GIT patch for the index name changes
Comment #2
geobaev commentedpatch applied
Comment #4
odizle commentedHi, I am having the same issue with the latest version, the default formats are missing. Cant seem to be able to patch it with this file.
Any Ideas?
Thanks
Comment #5
odizle commentedHi Guys please help me solve this.
I have this issue and I have tried the patch with no luck so I have manually replace the code with the one supplied here, that made the display format show all other formats apart from [shrinktheweb] like title as link, but when choosing Shrinktheweb format it dose not the preview.
I love this module but would really like help with this fix. Thanks
Comment #6
gaëlgThis code fix is not present but still needed in the last 7.x-1.9 release.
But the theme functions need to be updated accordingly:
theme_shrinktheweb_formatter_link_no_text->theme_shrinktheweb_formatter_stw_link_no_textAnd the hook_theme implementation too.
Comment #8
devdokimov commentedComment #10
devdokimov commented