Commit 2a31ed64 authored by pifagor's avatar pifagor
Browse files

Issue #2295071 by interX, pifagor: Recursion in field formatter with views....

Issue #2295071 by interX, pifagor: Recursion in field formatter with views. Issue #2195699 by Dane Powell, pifagor: Generate more creative URLS with devel_generate. Issue #2536756 by gareth-davies, pifagor: Unless using the default field formatter, classes are not transformed into an array which causes a fatal error.
parent 35fa08b3
......@@ -21,8 +21,9 @@ function link_devel_generate($object, $field, $instance, $bundle) {
* Callback for hook_devel_generate().
*/
function _link_devel_generate($object, $field, $instance, $bundle) {
$url = 'http://example.com/' . devel_generate_word(mt_rand(6, 12));
$link = array(
'url' => url('<front>', array('absolute' => TRUE)),
'url' => url($url, array('absolute' => TRUE)),
'attributes' => _link_default_attributes(),
);
if ($instance['settings']['title'] != 'none') {
......
......@@ -1140,7 +1140,9 @@ function link_field_formatter_view($entity_type, $entity, $field, $instance, $la
'#theme' => 'link_formatter_' . $display['type'],
'#element' => $item,
'#field' => $instance,
'#display' => $display,
'#display' => array(
'settings' => $display['settings']
),
);
}
return $elements;
......@@ -1243,6 +1245,9 @@ function theme_link_formatter_link_title_plain($vars) {
*/
function theme_link_formatter_link_url($vars) {
$link_options = $vars['element'];
if (isset($link_options['attributes']['class'])) {
$link_options['attributes']['class'] = array($link_options['attributes']['class']);
}
unset($link_options['title']);
unset($link_options['url']);
return $vars['element']['url'] ? l($vars['element']['display_url'], $vars['element']['url'], $link_options) : '';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment