Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
commerce_omniva
Commits
1a8d5199
Commit
1a8d5199
authored
Oct 29, 2015
by
ram4nd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve the code.
parent
c80c4d94
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
commerce_omniva.install
commerce_omniva.install
+1
-1
commerce_omniva.module
commerce_omniva.module
+3
-5
No files found.
commerce_omniva.install
View file @
1a8d5199
...
...
@@ -21,7 +21,7 @@ function commerce_omniva_field_schema($field) {
'type'
=>
'varchar'
,
'length'
=>
10
,
'not null'
=>
FALSE
,
),
),
);
$indexes
=
array
(
'zip'
=>
array
(
'zip'
),
...
...
commerce_omniva.module
View file @
1a8d5199
...
...
@@ -121,7 +121,7 @@ function commerce_omniva_field_settings_form($field, $instance, $has_data) {
function
commerce_omniva_field_validate
(
$entity_type
,
$entity
,
$field
,
$instance
,
$langcode
,
$items
,
&
$errors
)
{
foreach
(
$items
as
$delta
=>
$item
)
{
if
(
!
empty
(
$item
[
'zip'
]))
{
if
(
!
is_numeric
(
$item
[
'zip'
]))
{
if
(
!
is_numeric
(
$item
[
'zip'
]))
{
$errors
[
$field
[
'field_name'
]][
$langcode
][
$delta
][]
=
array
(
'error'
=>
'commerce_omniva_invalid'
,
'message'
=>
t
(
'You must select a location.'
),
...
...
@@ -146,6 +146,7 @@ function commerce_omniva_field_is_empty($item, $field) {
* Implements hook_field_formatter_info().
*
* I could define more that one display.
*
* @see field_example_field_formatter_view()
*/
function
commerce_omniva_field_formatter_info
()
{
...
...
@@ -172,9 +173,7 @@ function commerce_omniva_field_formatter_view($entity_type, $entity, $field, $in
$element
[
$delta
]
=
array
(
'#type'
=>
'html_tag'
,
'#tag'
=>
'p'
,
'#value'
=>
'<label> '
.
$t_name
.
':</label> '
.
$place
[
$item
[
'zip'
]][
'NAME'
],
'#value'
=>
'<label> '
.
$t_name
.
':</label> '
.
$place
[
$item
[
'zip'
]][
'NAME'
],
);
}
break
;
...
...
@@ -202,7 +201,6 @@ function commerce_omniva_field_widget_info() {
*
* hook_widget_form() is where Drupal tells us to create form elements for
* our field's widget.
*
*/
function
commerce_omniva_field_widget_form
(
&
$form
,
&
$form_state
,
$field
,
$instance
,
$langcode
,
$items
,
$delta
,
$element
)
{
$value
=
isset
(
$items
[
$delta
][
'zip'
])
?
$items
[
$delta
][
'zip'
]
:
''
;
...
...
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