CR: https://www.drupal.org/node/2183531

Quite a few of these have already been converted.

Also time to kill webform_variable_get().

CommentFileSizeAuthor
#10 replace_all-2500799-10.patch4.13 KBAnonymous (not verified)
#7 replace_all-2500799-7.patch3.93 KBAnonymous (not verified)
#4 replace_all-2500799-4.patch3.93 KBAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fenstrat’s picture

Committed and pushed a first pass to 8.x-4.x

This takes care of all the straight forward ones, there are a handful of trickier ones left, leaving open to finish up those.

  • fenstrat committed 61ee45f on 8.x-4.x
    Issue #2500799 by fenstrat: Replace all variable_get/set() calls with...
Anonymous’s picture

Assigned: Unassigned »

I'll try to do patch for this.

Anonymous’s picture

Status: Active » Needs review
FileSize
3.93 KB

Here is patch. Please review.

Anonymous’s picture

Assigned: » Unassigned
sumitmadan’s picture

Status: Needs review » Needs work

return drupal_tempnam(\Drupal::config('webform.settings')->get('webform_export_path'), 'webform_');

should be

return drupal_tempnam(\Drupal::config('webform.settings')->get('export_path'), 'webform_');

Anonymous’s picture

Status: Needs work » Needs review
FileSize
3.93 KB

I have fixed it. Thank you. Please review again)

fenstrat’s picture

Status: Needs review » Needs work

Thanks for the patches @bobrov1989!

  1. +++ b/config/install/webform.settings.yml
    @@ -33,3 +33,5 @@ allowed_tags:
    +export_path: 'temporary://'
    +table: 0
    

    These also need to be added to webform.schema.yml

  2. +++ b/includes/webform.report.inc
    @@ -18,7 +18,7 @@ function webform_results_submissions($node, $user_filter, $pager_count) {
    -  if (!webform_variable_get('webform_table')) {
    +  if (!\Drupal::config('webform.settings')->get('table')) {
    

    The old webform_table variable is going to be removed as we'll be removing support for the old hard coded table listings and only offering their new views equivalents (which is already the default in 7.x-4.x). However I guess that's out of scope for this issue so a simple replacement for now is ok.

  3. +++ b/includes/webform.report.inc
    @@ -802,7 +803,7 @@ function webform_results_download_form_submit(&$form, &$form_state) {
    -  return drupal_tempnam(variable_get('webform_export_path', 'temporary://'), 'webform_');
    +  return drupal_tempnam(\Drupal::config('webform.settings')->get('export_path'), 'webform_');
    

    Is temporary:// still the correct default here in D8? I imagine it is but would like to be sure.

  4. +++ b/webform.module
    @@ -4415,11 +4403,12 @@ function webform_date_string($array, $type = NULL) {
    -    $format = variable_get('date_format_' . $type_name, 'D, m/d/Y');
    +    $format = $config->get('date_format_' . $type_name) ? $config->get('date_format_' . $type_name) : 'D, m/d/Y';
    

    This is incorrect as before it was looking for the "global" 'date_format_' . $type_name variable yet here you're looking in webform.settings. Additionally I'm guessing the date module's changed the way it stores date formats (i.e. is it actually stored in 'date_format_' . $type_name?) so it will probably need to be adjusted for that.

Anonymous’s picture

Assigned: Unassigned »

Ok, I'll fix it.

Anonymous’s picture

Assigned: » Unassigned
Status: Needs work » Needs review
FileSize
4.13 KB

Thank you.

1. I've added it.
2. Still the same for this task, you can create a new one and we'll remove this.
3. According to core\includes\file.inc this path is still correct in d8 for now.
4. I look closely and I've noticed that d8 stores date formats in core.date_format.FORMAT_NAME config objects.

Please review.

fenstrat’s picture

Status: Needs review » Fixed

Committed and pushed to 8.x-4.x.

Thanks for your answers in #10 @bobrov1989.

  1. One small issue fixed on commit:
    +++ b/config/install/webform.settings.yml
    @@ -33,3 +33,5 @@ allowed_tags:
    +table: 0
    

    table is a boolean and should default to false (again it will be removed in the near future once views support is ported). This also made me open #2504493: Standardise config types and defaults.

  2. +++ b/webform.module
    @@ -4419,7 +4407,7 @@ function webform_date_format($type = NULL, $exclude = array()) {
    -    $format = variable_get('date_format_' . $type_name, 'D, m/d/Y');
    +    $format = \Drupal::config('core.date_format.' . $type_name)->get('pattern') ? \Drupal::config('core.date_format.' . $type_name)->get('pattern') : 'D, m/d/Y';
    

    I can also confirm that \Drupal::config('core.date_format.non_existent_format')->get('pattern') returns NULL, so all good there too.
    I'm a little hesitant to leave the default 'D, m/d/Y' hard coded there, however as it differs from the default 'medium' format I think it's ok to do so.
    Also no need to call config->get twice, instead I just assigned it to a local variable, fixed on commit.

  • fenstrat committed ebe9980 on 8.x-4.x authored by bobrov1989
    Issue #2500799 by bobrov1989: Replace remaining variable_get/set() calls...
Anonymous’s picture

Great))) thx

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.