Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The various devel_generate_* functions call theme() in the process of setting a message. e.g.
$new_terms = devel_generate_terms($num_terms, $vocabs, $title_length);
if (!empty($new_terms)) {
drupal_set_message(t('Created the following new terms: !terms', array('!terms' => theme('item_list', array('items' => $new_terms)))));
}
If called during a custom install profile, this call to theme() will be unnecessarily slow because a large set of normally cached data has to be rebuilt (there is no cache during install). So during an install profile, some other methodology should be used to build the output for that message.
e.g. Perhaps:
$new_terms = devel_generate_terms($num_terms, $vocabs, $title_length);
if (!empty($new_terms)) {
if (variable_get('install_task' == 'done') {
drupal_set_message(t('Created the following new terms: !terms', array('!terms' => theme('item_list', array('items' => $new_terms)))));
}
else {
drupal_set_message(t('Created the following new terms: @terms', array('@terms' => implode(', ', $new_terms))));
}
}
Comment | File | Size | Author |
---|---|---|---|
#4 | 1645398-devel_generate-avoid_call_theme-4.patch | 2.16 KB | pcambra |
Comments
Comment #1
salvisPatch for D8 first, rtbc, commit, backport to D7, rtbc, commit...
Comment #2
moshe weitzman CreditAttribution: moshe weitzman commentedI'd be OK with just moving to comma delimited always, instead of special casing for for install profile. Not sure how others feel about this.
Comment #3
exratione CreditAttribution: exratione commentedAlways comma delimited is fine by me.
Comment #4
pcambraAgreed with the comma separated values, here's a patch for it.
Comment #5
pcambraTagging
Comment #6
pcambraAs it seems there's consensus, I've committed this in D8 & D7.
Thanks!
Comment #7.0
(not verified) CreditAttribution: commentedCan't type.