You are here

function simpleads_taxonomy_term_insert in SimpleAds 7

Implements hook_taxonomy_term_insert().

File

./simpleads.module, line 197

Code

function simpleads_taxonomy_term_insert($term) {
  if ($term->vocabulary_machine_name == 'ad_groups') {
    $ad_group_name = $term->name;
    $tid = $term->tid;
    $block_delta = $term->vocabulary_machine_name . '_' . $tid;
    $settings = array(
      'ads_limit' => 1,
      'ads_width' => '',
      'ads_height' => '',
      'block_info' => $ad_group_name,
      'block_subject' => t('Advertisement'),
      'block_delta' => $block_delta,
      'ads_page' => '',
      'ads_order' => 0,
    );
    db_insert('simpleads_blocks')
      ->fields(array(
      'tid' => $tid,
      'settings' => serialize($settings),
    ))
      ->execute();
  }
}