You are here

function _crumbs_admin_display_submit_checkboxes_changed in Crumbs, the Breadcrumbs suite 7.2

Determine if a submitted checkboxes element value has changed.

Parameters

array $element: Form element with "#type" = "checkboxes".

Return value

bool TRUE, if the value has changed. That is, if some checkboxes have been checked or unchecked.

1 call to _crumbs_admin_display_submit_checkboxes_changed()
_crumbs_admin_display_submit_flush_cache in admin/crumbs.admin.inc
Additional submit handler for crumbs_admin_display_form, that will flush the crumbs-related caches.

File

admin/crumbs.admin.inc, line 259

Code

function _crumbs_admin_display_submit_checkboxes_changed($element) {
  $before = $element['#default_value'];
  $after = $element['#value'];
  foreach ($before as $key => $value) {
    if ($key === $value) {
      if (!isset($after[$key])) {

        // Found a difference.
        return TRUE;
      }
      unset($after[$key]);
    }
  }
  return !empty($after);
}