You are here

function floating_block_admin_validate in Floating block 6

Same name and namespace in other branches
  1. 7 floating_block.admin.inc \floating_block_admin_validate()

File

./floating_block.admin.inc, line 29
Admin page callbacks for the floating_block module.

Code

function floating_block_admin_validate($form, &$form_state) {
  $array = _floating_block_admin_convert_text_to_array($form_state['values']['floating_blocks']);
  $string = _floating_block_admin_convert_array_to_text($array);

  // Compare that floating block settings string to array conversion is
  // idempotent. New line characters \n and \r get make comparison difficult.
  if (str_replace(array(
    "\n",
    "\r",
  ), '', $string) != str_replace(array(
    "\n",
    "\r",
  ), '', $form_state['values']['floating_blocks'])) {
    form_set_error('floating_blocks', t('Each line must of the format: <code>selector|setting_key=setting_value,setting_key=setting_value,...</code>'));
  }
}