Skip to content

Commit 843b5cf

Browse files
committed
Better support for views admin form
1 parent 7574797 commit 843b5cf

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

cs_date_formatter.module

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,15 @@ function cs_date_formatter_field_formatter_settings_form($field, $instance, $vie
5252
),
5353
);
5454

55-
$name_attribute = 'fields[' . $field['field_name'] . '][settings_edit_form][settings][date_format]';
55+
// Consider we're on a views admin form, which uses different attributes than
56+
// the regular field UI admin form.
57+
$args = arg();
58+
if (isset($args[2]) && $args[2] == 'views') {
59+
$name_attribute = 'options[settings][date_format]';
60+
}
61+
else {
62+
$name_attribute = 'fields[' . $field['field_name'] . '][settings_edit_form][settings][date_format]';
63+
}
5664
$states = array(
5765
'invisible' => array(
5866
':input[name="' . $name_attribute . '"]' => array('value' => 'simple'),

0 commit comments

Comments
 (0)