You are here

function i18nblocks_get_metablock in Internationalization 5.3

Same name and namespace in other branches
  1. 5 i18nblocks/i18nblocks.module \i18nblocks_get_metablock()
  2. 5.2 i18nblocks/i18nblocks.module \i18nblocks_get_metablock()

Db layer: for now it stores each block as a variable

3 calls to i18nblocks_get_metablock()
i18nblocks_admin in i18nblocks/i18nblocks.module
Add a new metablock and go to settings page
i18nblocks_block in i18nblocks/i18nblocks.module
Implementation of hook_block()
i18nblocks_form_alter in i18nblocks/i18nblocks.module
Implementation of block form_alter().

File

i18nblocks/i18nblocks.module, line 275

Code

function i18nblocks_get_metablock($delta, $getblocks = FALSE) {
  $metablock = db_fetch_object(db_query("SELECT b.*, i.* FROM {blocks} b INNER JOIN {i18n_blocks} i ON b.delta = i.delta WHERE b.module = 'i18nblocks' AND b.delta = '%s'", $delta));
  if ($getblocks) {
    $result = db_query("SELECT * FROM {i18n_blocks_i18n} WHERE bid = '%s'", $delta);
    $metablock->blocks = array();
    while ($block = db_fetch_object($result)) {
      $metablock->blocks[$block->language] = $block;
    }
  }
  return $metablock;
}