Get config variable value in hook_block_list_alter works I have added a new field to block configuration settings by using the function  hook_form_FORM_ID_alter. I used submit handler to save the variable $form['#submit'][] = mymodule_submit (as block_save function was not called). Its all done till here
Now I am trying to alter the block list based on the condition set in the config field enable_conectivity
function mymodule_block_list_alter(&amp;$blocks) {


    foreach ($blocks as $key =&gt; $block) {
       $enable_conectivity =??//How to get the varibale value
        if($enable_conectivity) {
            $blocks[$key]-&gt;visibility = BLOCK_CUSTOM_DISABLED;
        }
    }
}

I tried to call function hook_block_view it is not called instead hook_block_view_alter works.

Issue:Saving is affecting all the blocks
function mymodule_submit($form, &amp;$form_state) {
     variable_set('url_to_check', $form_state['values']['url_to_check']);
     variable_set('enable_check', $form_state['values']['enable_check']);
}

hook_form_FORM_ID_alter()
$form['visibility']['mycustom'] = array(
  '#type' =&gt; 'fieldset',
  '#title' =&gt; t('ConnectCheck'),
  '#collapsible' =&gt; TRUE,
  '#collapsed' =&gt; TRUE,
  '#group' =&gt; 'visibility',
 '#weight' =&gt; 20,
);
$form['visibility']['mycustom']['enable_check'] = array(
  '#type' =&gt; 'checkbox',
  '#title' =&gt; t('Show block only when user can connect to internet'),
  '#default_value' =&gt; variable_get('enable_check', FALSE),
);
$form['visibility']['mycustom']['url_to_check'] = array(
   '#type' =&gt; 'textfield',
   '#title' =&gt; t('Url to check'),
   '#maxlength' =&gt; 90,
   '#default_value' =&gt; variable_get('url_to_check', 'www.google.com'),
   '#states' =&gt; array(
     'visible' =&gt; array(
        'input[name=&quot;enable_check&quot;]' =&gt; array('checked' =&gt; TRUE),
    ),
  ),
);

I am trying to disable the block which requires to connect internet.
It should disable to only those user who do not have internet access.
Assuming you've set the variable using the variable_set() function, you can get the value using the variable_get() function.
From the docs:

Returns a persistent variable.
Case-sensitivity of the variable_* functions depends on the database collation used. To avoid problems, always use lower case for persistent variable names.

In your case the foreach loop would become :
foreach ($blocks as $key =&gt; $block) {
  $enable_conectivity = variable_get('enable_conectivity', TRUE); // Default value of `TRUE` is returned if the variable is not set.
  if($enable_conectivity) {
    $blocks[$key]-&gt;visibility = BLOCK_CUSTOM_DISABLED;
  }
}