src/pyams_content/shared/form/zmi/field.py
changeset 873 5f40601f9cb0
parent 842 7f0d72e427b1
child 1070 ea0c7ac589c4
--- a/src/pyams_content/shared/form/zmi/field.py	Fri Jul 20 01:02:27 2018 +0200
+++ b/src/pyams_content/shared/form/zmi/field.py	Fri Jul 20 12:39:19 2018 +0200
@@ -100,11 +100,18 @@
             'data-ams-plugin-pyams_content-src': get_resource_path(pyams_content),
             'data-ams-location': absolute_url(IFormFieldContainer(self.context), self.request),
             'data-ams-tablednd-drag-handle': 'td.sorter',
-            'data-ams-tablednd-drop-target': 'set-form-fields-order.json',
-            'data-ams-visibility-switcher': 'switch-form-field-visibility.json'
+            'data-ams-tablednd-drop-target': 'set-form-fields-order.json'
         }
+        attributes.setdefault('td', {}).update({
+            'data-ams-attribute-switcher': self.get_switcher_target
+        })
         return attributes
 
+    @staticmethod
+    def get_switcher_target(element, column):
+        if column.__name__ == 'show-hide':
+            return 'switch-form-field-visibility.json'
+
     @reify
     def values(self):
         return list(super(FormFieldsContainerTable, self).values)