You are here

function ccl_update_7101 in Custom Contextual Links 7

Same name and namespace in other branches
  1. 8 ccl.install \ccl_update_7101()

Fix entries with old node ID tokens to work with the core token integration.

File

./ccl.install, line 57
Provides install, upgrade and un-install functions for ccl.

Code

function ccl_update_7101() {
  $rows = db_select('ccl', 'c')
    ->fields('c', array(
    'clid',
    'link',
  ))
    ->condition('link', '%\\%nid%', 'LIKE')
    ->execute();
  foreach ($rows as $row) {
    $row->link = str_replace('%nid', '[node:nid]', $row->link);
    db_update('ccl')
      ->fields(array(
      'link' => $row->link,
    ))
      ->condition('clid', $row->clid)
      ->execute();
  }
}