You are here

function fe_block_machine_name_submit in Features Extra 7

Same name and namespace in other branches
  1. 6 fe_block.module \fe_block_machine_name_submit()

Save machine name.

1 string reference to 'fe_block_machine_name_submit'
fe_block_form_alter in fe_block/fe_block.module
Implements hook_form_alter().

File

fe_block/fe_block.module, line 950
Provide features components for exporting core blocks and settings.

Code

function fe_block_machine_name_submit($form, &$form_state) {

  // If a block id is not given, retrieve it from the database.
  if (empty($form_state['values']['bid'])) {
    $form_state['values']['bid'] = db_select('block_custom')
      ->fields('block_custom', array(
      'bid',
    ))
      ->condition('info', $form_state['values']['info'])
      ->execute()
      ->fetch()->bid;
  }
  if (empty($form_state['values']['bid'])) {
    return;
  }
  $table = 'fe_block_boxes';
  db_delete($table)
    ->condition('bid', $form_state['values']['bid'])
    ->execute();
  if (!empty($form_state['values']['machine_name'])) {
    drupal_write_record($table, $form_state['values']);
  }
}