Commit fffb5d9f authored by makbul_khan8's avatar makbul_khan8 Committed by pifagor
Browse files

Issue #2718563 by makbul_khan8, jgalletta, idebr, malcomio, joekers,...

Issue #2718563 by makbul_khan8, jgalletta, idebr, malcomio, joekers, b.lammers, pifagor: Use link field widget in custom form
parent 695ef7bb
......@@ -937,6 +937,19 @@ function _link_default_attributes() {
*/
function link_field_process($element, $form_state, $complete_form) {
$instance = field_widget_instance($element, $form_state);
if (!$instance) {
// The element comes from a custom form, we have to manually create the
// $instance settings.
$instance['settings'] = array (
'title_maxlength' => isset($element['#title_maxlength']) ? $element['#title_maxlength'] : 128,
'title' => isset($element['#title_mode']) ? $element['#title_mode'] : 'optional',
'title_label_use_field_label' => isset($element['#title_label_use_field_label']) ? $element['#title_label_use_field_label'] : FALSE,
'url' => isset($element['#url']) ? $element['#url'] : 'optional',
);
if (isset($element['#attributes'])) {
$instance['settings']['attributes'] = $element['#attributes'];
}
}
$settings = $instance['settings'];
$element['url'] = array(
'#type' => 'textfield',
......
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