You are here

function webform_update_7411 in Webform 7.4

Remove [submission:values:x] token use of :nolabel and add :withlabel.

File

./webform.install, line 1817
Webform module install/schema hooks.

Code

function webform_update_7411(&$sandbox) {

  // Define replacements.
  $patterns = array();
  $replacements = array();
  $dpatterns = array(
    '/\\[submission:values(:(?!nolabel)[a-z_]+)+\\]/m',
    '/\\[submission:values(:([a-z_:]+))?:nolabel\\]/m',
  );
  $dreplacements = array(
    '[submission:values$1:withlabel]',
    '[submission:values$1]',
  );
  $limit = webform_variable_get('webform_update_batch_size');
  $processed_count = _webform_update_7401_batch($sandbox, $patterns, $replacements, $dpatterns, $dreplacements, $limit);

  // If less than limit was processed, the update process is finished.
  if ($processed_count < $limit || $sandbox['progress'] == $sandbox['max']) {
    $finished = TRUE;
  }

  // If there's no max value then there's nothing to update and we're finished.
  if (empty($sandbox['max']) || isset($finished)) {
    return t('Replaced tokens using [submission:values:x] with [submission:values:x:withlabel].');
  }
  else {

    // Indicate our current progress to the batch update system.
    $sandbox['#finished'] = $sandbox['progress'] / $sandbox['max'];
  }
}