Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
soft_length_limit
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
soft_length_limit
Commits
ba6ce37a
Commit
ba6ce37a
authored
10 years ago
by
Camilla Krag Jensen
Browse files
Options
Downloads
Patches
Plain Diff
Fix an undefined index notice on soft_length_minimum.
Also made some small changes to the code for readability.
parent
116da947
Branches
7.x-1.x
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
soft_length_limit.module
+20
-9
20 additions, 9 deletions
soft_length_limit.module
with
20 additions
and
9 deletions
soft_length_limit.module
+
20
−
9
View file @
ba6ce37a
...
@@ -200,21 +200,32 @@ function soft_length_limit_field_attach_form($entity_type, $entity, &$form, &$fo
...
@@ -200,21 +200,32 @@ function soft_length_limit_field_attach_form($entity_type, $entity, &$form, &$fo
function
soft_length_limit_set_attr
(
&
$element
,
$sub_elements
)
{
function
soft_length_limit_set_attr
(
&
$element
,
$sub_elements
)
{
$children
=
element_get_visible_children
(
$element
);
$children
=
element_get_visible_children
(
$element
);
$types
=
_soft_length_limit_types
(
'elements'
);
$types
=
_soft_length_limit_types
(
'elements'
);
foreach
(
$children
as
$value
)
{
foreach
(
$children
as
$value
)
{
if
(
isset
(
$element
[
$value
][
'#type'
])
&&
isset
(
$types
[
$element
[
$value
][
'#type'
]]))
{
if
(
isset
(
$element
[
$value
][
'#type'
])
&&
isset
(
$types
[
$element
[
$value
][
'#type'
]]))
{
if
(
isset
(
$element
[
$value
][
'#field_name'
])
&&
isset
(
$sub_elements
[
$element
[
$value
][
'#field_name'
]]))
{
if
(
isset
(
$element
[
$value
][
'#field_name'
])
&&
isset
(
$sub_elements
[
$element
[
$value
][
'#field_name'
]]))
{
$soft_limit
=
$sub_elements
[
$element
[
$value
][
'#field_name'
]][
'widget'
][
'settings'
][
'soft_length_limit'
];
$soft_min
=
$sub_elements
[
$element
[
$value
][
'#field_name'
]][
'widget'
][
'settings'
][
'soft_length_minimum'
];
$widget_settings
=
isset
(
$sub_elements
[
$element
[
$value
][
'#field_name'
]][
'widget'
][
'settings'
])
?
$sub_elements
[
$element
[
$value
][
'#field_name'
]][
'widget'
][
'settings'
]
:
FALSE
;
$element
[
$value
][
'#soft_length_limit'
]
=
(
isset
(
$element
[
$value
][
'#maxlength'
])
&&
$soft_limit
>
$element
[
$value
][
'#maxlength'
])
?
$element
[
$value
][
'#maxlength'
]
:
$soft_limit
;
if
(
isset
(
$sub_elements
[
$element
[
$value
][
'#field_name'
]][
'widget'
][
'settings'
][
'soft_length_style_select'
]))
{
if
(
$widget_settings
)
{
$soft_enhance
=
$sub_elements
[
$element
[
$value
][
'#field_name'
]][
'widget'
][
'settings'
][
'soft_length_style_select'
];
// Soft limit length.
$element
[
$value
][
'#attributes'
][
'data-soft-length-style-select'
]
=
$soft_enhance
;
$soft_limit
=
$widget_settings
[
'soft_length_limit'
];
$element
[
$value
][
'#soft_length_limit'
]
=
(
isset
(
$element
[
$value
][
'#maxlength'
])
&&
$soft_limit
>
$element
[
$value
][
'#maxlength'
])
?
$element
[
$value
][
'#maxlength'
]
:
$soft_limit
;
$element
[
$value
][
'#attributes'
][
'data-soft-length-limit'
]
=
$soft_limit
;
$element
[
$value
][
'#attributes'
][
'class'
][]
=
'soft-length-limit'
;
// Soft minimum.
$soft_min
=
isset
(
$widget_settings
[
'soft_length_minimum'
])
?
$widget_settings
[
'soft_length_minimum'
]
:
''
;
$element
[
$value
][
'#attributes'
][
'data-soft-length-minimum'
]
=
$soft_min
;
// Length style select.
if
(
isset
(
$widget_settings
[
'soft_length_style_select'
]))
{
$element
[
$value
][
'#attributes'
][
'data-soft-length-style-select'
]
=
$widget_settings
[
'soft_length_style_select'
];
}
}
}
$element
[
$value
][
'#attributes'
][
'class'
][]
=
'soft-length-limit'
;
$element
[
$value
][
'#attributes'
][
'data-soft-length-limit'
]
=
$soft_limit
;
$element
[
$value
][
'#attributes'
][
'data-soft-length-minimum'
]
=
$soft_min
;
}
}
}
}
soft_length_limit_set_attr
(
$element
[
$value
],
$sub_elements
);
soft_length_limit_set_attr
(
$element
[
$value
],
$sub_elements
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment