You are here

function fe_block_get_bid in Features Extra 7

Returns the block id that corresponds to a given machine name.

Parameters

string $machine_name: The machine name of a block for which to retrieve the block id.

Return value

int | FALSE The block id, or FALSE if the machine name was not found.

5 calls to fe_block_get_bid()
FeaturesExtraBlockTestCase::testBlockCacheAlter in tests/fe_block.test
Tests the integration with the Block Cache Alter module.
FeaturesExtraBlockTestCase::testBlockRevert in tests/fe_block.test
Test if custom blocks can be reverted and that overrides are detected.
fe_block_boxes_features_revert in fe_block/fe_block.module
Implements hook_features_revert().
_fe_block_get_bid in fe_block/fe_block.module
Provided for backwards compatibility. Use fe_block_get_bid() instead.
_fe_block_prepare_custom_blocks_for_import in fe_block/fe_block.module
Helper function. Prepares an exported core custom block for import.

File

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

Code

function fe_block_get_bid($machine_name, $reset = FALSE) {
  $bids =& drupal_static(__FUNCTION__);
  if (!isset($bids[$machine_name]) || $reset) {
    $result = db_select('fe_block_boxes')
      ->fields('fe_block_boxes', array(
      'bid',
    ))
      ->condition('machine_name', $machine_name)
      ->execute()
      ->fetch();
    if (empty($result)) {
      return FALSE;
    }
    $bids[$machine_name] = (int) $result->bid;
  }
  return $bids[$machine_name];
}