function IpBanAdmin::iPBanDisabledBlocksValidate in IP Ban 8
Determine if blocks entered are valid and formatted correctly.
File
- src/
Form/ IpBanAdmin.php, line 220
Class
Namespace
Drupal\ip_ban\FormCode
function iPBanDisabledBlocksValidate($form, &$form_state) {
// $disabled_blocks = \Drupal\Component\Utility\Html::escape($form_state['values']['ip_ban_disabled_blocks']);
// if (!empty($disabled_blocks)) {
// $disabled_block_array = explode(PHP_EOL, $disabled_blocks);
// foreach ($disabled_block_array as $disabled_block) {
// // First determine if the user entered two strings separated by a space.
// $module_and_delta = explode(',', trim($disabled_block));
// if (count($module_and_delta) != 2) {
// form_set_error('ip_ban_disabled_blocks', t('You have one or more blocks with an incorrect format; you must enter exactly one module name and delta name per line, separated by a comma.'));
// }
// else {
// $module = trim($module_and_delta[0]);
// $delta = trim($module_and_delta[1]);
// // Second determine if the block entered is a valid block.
// $disabled_block = db_query('SELECT * FROM {block} WHERE module = :module AND delta = :delta', array(':module' => $module, ':delta' => $delta))->fetchAll();
// if (empty($disabled_block)) {
// form_set_error('ip_ban_disabled_blocks', t('You entered at least one invalid module name or delta; see the help text for how to enter the proper module name and delta.'));
// }
// // Todo: add check for block enabled status for enabled themes.
// // If block disabled for all enabled themes (including admin theme),
// // set form error.
// }
// }
// }
}