You are here

function om_tools_admin_js in OM Tools 6.2

Same name and namespace in other branches
  1. 8.2 inc/om_tools.utils.inc \om_tools_admin_js()
  2. 7.2 inc/om_tools.utils.inc \om_tools_admin_js()

Admin - hide/show tool forms

1 call to om_tools_admin_js()
om_tools_admin in inc/om_tools.admin.inc
Admin Form - Simple Editing

File

inc/om_tools.utils.inc, line 88
OM Tools Admin Utilities

Code

function om_tools_admin_js($subtools = array()) {
  $add_js = '';
  $add_js .= "\$(document).ready(function(){";
  foreach ($subtools as $key => $subtool) {
    $add_js .= "om_set_switch('" . $subtool . "');";
  }
  $add_js .= "\n\t    function om_set_switch(idname) {\n        \$('#edit-' + idname + '-switch').change(\n          function() {\n            if (\$('#edit-' + idname + '-switch').attr('checked') == '') {\n              \$('#om-group-' + idname + '-settings').css('display', 'none');\n            } else  {\n              \$('#om-group-' + idname + '-settings').css('display', 'block');\n            }\n          }\n        );\n        if (\$('#edit-' + idname + '-switch').attr('checked') == '') {\n          \$('#om-group-' + idname + '-settings').css('display', 'none');\n        } else {\n          \$('#om-group-' + idname + '-settings').css('display', 'block');\n        }\t\n\t    }\n    }); ";
  drupal_add_js($add_js, "inline");
}