Pass block configuration item text field value to variable I have a custom block module that has a configuration form of type text_field. If there is a value entered into the configuration form, I want to store that value in a variable.

Here is the configuration hook:

/**
 * Implements hook_block_configure().
 */
function roadmap_block_configure($delta = 'roadmap') {
  // This example comes from node.module.
  $form = array();

  switch($delta) {
    case 'roadmap' :
      $form['roadmap_configuration_form'] = array(
      '#type' =&gt; 'text_format',
      '#title' =&gt; t('Enter an alternative URL.'),
// the URL entered will be sanitized and attached to hook_block_view(), and ultimately passed to a custom JavaScript file.
    );
    break;
  }
  return $form;
}


If there is a value entered into the configuration form, how can I store it in a variable?
So if this is for admin/editors only, one way to do it is to use the built-in Drupal hook_settings_form in your custom module. Here is a nice DO tutorial: https://www.drupal.org/docs/7/creating-custom-modules/creating-the-configuration-form

So in your case, this could look something like: 

/**
 * Implements hook_settings_form() to configure module.
 */
function roadmap_settings_form($settings) {

  $form = array();
  $form['roadmap_url'] = array(
      '#type' =&gt; 'text_format',
      '#title' =&gt; t('Enter an alternative URL.'),
  );
  return system_settings_form($form);
}


this form will save the value as a system variable 'roadmap_url' or whatever value you enter in the form field's machine name. you'd probably need to call this from some admin page in your custom module like so:

/**
 * Implements hook_menu().
 */
function roadmap_menu() {
  return array(
    'admin/config/roadmap_OR_SOME_OTHER_PATH' =&gt; array(
      'title' =&gt; t('Roadmap settings'),
      'page callback' =&gt; 'drupal_get_form',
      'page arguments' =&gt; array('roadmap_settings_form'),
      'access arguments' =&gt; array('administer roadmap OR SOME OTHER PERMISSION'),
      'type' =&gt; MENU_LOCAL_TASK,
    ),
  );
}


Now you should be able to go to your config page, enter your URL setting and it will be saved automatically by Drupal. To access this variable, you just need to call:

$url = variable_get('roadmap_url');