Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
drupal.org
link
Commits
0b3bcb91
Commit
0b3bcb91
authored
Feb 06, 2013
by
John Fiala
Browse files
Issue #949604 by zilverdistel: Added i18n support for the static link text field option.
parent
d519981b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
link.module
link.module
+27
-2
No files found.
link.module
View file @
0b3bcb91
...
...
@@ -476,6 +476,10 @@ function _link_sanitize(&$item, $delta, &$field, $instance, &$entity) {
// Use the title defined at the instance level.
if
(
$instance
[
'settings'
][
'title'
]
==
'value'
&&
strlen
(
trim
(
$instance
[
'settings'
][
'title_value'
])))
{
$title
=
$instance
[
'settings'
][
'title_value'
];
if
(
function_exists
(
'i18n_string_translate'
))
{
$i18n_string_name
=
"field:
{
$instance
[
'field_name'
]
}
:
{
$instance
[
'bundle'
]
}
:title_value"
;
$title
=
i18n_string_translate
(
$i18n_string_name
,
$title
);
}
}
// Use the title defined by the user at the widget level.
elseif
(
isset
(
$item
[
'title'
]))
{
...
...
@@ -623,7 +627,7 @@ function link_theme() {
'variables'
=>
array
(
'element'
=>
NULL
),
),
'link_formatter_link_domain'
=>
array
(
'variables'
=>
array
(
'element'
=>
NULL
),
'variables'
=>
array
(
'element'
=>
NULL
,
'display'
=>
NULL
),
),
'link_formatter_link_title_plain'
=>
array
(
'variables'
=>
array
(
'element'
=>
NULL
),
...
...
@@ -635,7 +639,7 @@ function link_theme() {
'variables'
=>
array
(
'element'
=>
NULL
),
),
'link_formatter_link_label'
=>
array
(
'variables'
=>
array
(
'element'
=>
NULL
),
'variables'
=>
array
(
'element'
=>
NULL
,
'field'
=>
NULL
),
),
'link_formatter_link_separate'
=>
array
(
'variables'
=>
array
(
'element'
=>
NULL
),
...
...
@@ -1293,3 +1297,24 @@ function link_field_item_property_info() {
);
return
$properties
;
}
/**
* Implements hook_field_update_instance().
*/
function
link_field_update_instance
(
$instance
,
$prior_instance
)
{
if
(
function_exists
(
'i18n_string_update'
)
&&
$prior_instance
[
'settings'
][
'title_value'
]
!=
$instance
[
'settings'
][
'title_value'
])
{
$i18n_string_name
=
"field:
{
$instance
[
'field_name'
]
}
:
{
$instance
[
'bundle'
]
}
:title_value"
;
i18n_string_update
(
$i18n_string_name
,
$instance
[
'settings'
][
'title_value'
]);
}
}
/**
* Implements hook_i18n_string_list_TEXTGROUP_alter().
*/
function
link_i18n_string_list_field_alter
(
&
$strings
,
$type
=
NULL
,
$object
=
NULL
)
{
if
(
$type
==
'field_instance'
&&
$object
&&
$object
[
'widget'
][
'type'
]
==
'link_field'
)
{
if
(
isset
(
$object
[
'settings'
][
'title_value'
]))
{
$strings
[
'field'
][
$object
[
'field_name'
]][
$object
[
'bundle'
]][
'title_value'
][
'string'
]
=
$object
[
'settings'
][
'title_value'
];
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment