Closed (fixed)
Project:
Scheduler
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
2 Feb 2015 at 12:17 UTC
Updated:
9 Mar 2016 at 14:31 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jazio commentedComment #2
jazio commentedI made the first iteration.
Comment #3
jazio commentedComment #4
jazio commentedI've replaced the occurences of variable_get. Still some variables coming from other modules like Date have unknown location and need reviewed.
Comment #5
legovaerAfter analyzing your patch, I think we still have some work to do. The approach is good, but we still need to rework some parts. In general, I think we need to re-think about the naming of all the variables. Using variables with more then 1 underscore can be added into a nested parent variable. Here is an overview of my detailed comments;
Weird parameter provided in config() method.
Maybe this is a typo? I think it needs to be replaced with date.
if (\Drupal::config('??')->get('configurable_timezones')) { ...Usage of scheduler.schema
I noticed that you are using
scheduler.schemainstead ofscheduler.settings. This needs to be changed, otherwise Drupal won't be able to interact with the configuration file (scheduler.settings.yml).Wrong usage of the config parameter.
In some parts of your code you are using the wrong configuration parameter structure. Instead of a . (dot), you're using a _ (underscore).
$create_publishing_revision = \Drupal::config('scheduler_schema')->get('scheduler_publish_revision_' . $n->type) == 1;Should become
$create_publishing_revision = \Drupal::config('scheduler.settings')->get('scheduler_publish_revision_' . $n->type) == 1;Investigation of vertical tabs
You added a comment saying that we have to investigate the yaml file of the vertical tabs. This seems unnecessary to me because we have to store this as a variable inside our variables.
+ $use_vertical_tabs = \Drupal::config('vertical_tabs')->get('use_vertical_tabs_' . $form['type']['#value']);Should become;
+ $use_vertical_tabs = \Drupal::config('scheduler.schema')->get('use_vertical_tabs_' . $form['type']['#value']);Comment #6
jazio commentedThanks for the detailed analysis. I posted a new iteration.
My questions are:
1. You mention will be using only one setting yml file and that will be always: scheduler.settings.yml. In this case in your latest suggestion is it a typo: 'scheduler.schema'?
2. What is the real purpose of scheduler.schema?
3. I expect I need to fill in scheduler.settings with default values of the all variables over the project.
How should be handled the defaults for variables like
use_vertical_tabs_' . $form['type']['#value']? You mention this 'Using variables with more then 1 underscore can be added into a nested parent variable'. Could you point me to a module where I can see this?Comment #7
pfrenssenThanks a lot for working on this!
Start comments with a capital letter and end with a period.
Can you add the @todo here as well so we don't forget to look at it again later?
Most of the other conversions are actually quite special, they are using the new Third Party Settings.
The issue summary is wrong. These can not be converted straight to Config. My apologies, I turned the advice from the Drupal Module Upgrader module into separate issues without verifying them.
We will first have to convert these forms to form classes, and then include the ThirdPartySettingsTrait. This can be quite interesting.
I will mark this as postponed until the forms are converted. I will make issues to convert all the forms.
Comment #8
jazio commentedTiny fix over @todo comments.
Comment #9
jazio commentedComment #10
jonathan1055 commented#2418527: Replace variable_set() with config has landed so this isssue can now be unblocked.
Comment #11
legovaerI was not able to apply the patch from #6. Already too many changes went in after this patch has been created. I created a new patch from scratch.
Comment #13
pfrenssenAll the configuration which is node type specific is now stored as ThirdPartySettings. This seems to cover almost all cases in the patch.
Comment #14
joekersComment #15
joekersI have updated most of patch in comment #11 to use the ThirdPartySettings. The only thing I'm not sure on is where I've used it in scheduler_feeds_processor_targets_alter() and scheduler_i18n_sync_options()?
Comment #17
legovaerWe should store this entity inside a local variable. Something like:
I suggest to keep this as a separate variable. Now that I'm reviewing it myself, I notice that it is hard to read.
Testcases are getting fixed in #2594615: Automated testing in 8.x [meta] so it's not necessary to update them in this issue.
Comment #18
joekersThanks for the feedback :)
Not sure how the changes to scheduler.test crept in there but I've removed them and made the other changes in this patch.
Comment #19
joshi.rohit100Comment #23
jonathan1055 commentedThanks for working on this patch. I had a look and was just wondering the correct way to get thirdparty settings. In scheduler.module you have
but it scheduler.cron.inc you have
So the questions is whether the extra prefix 'scheduler' is needed in the second parameter or not?
I think that this problem may be hindering the test results in #2594615: Automated testing in 8.x [meta] so it would be good to get this sorted.
Comment #24
joekersYeah it shouldn't have the 'scheduler' prefix. I'll update the patch as soon as I get chance.
Comment #25
joekersI've removed the 'scheduler' prefix on all of the getThirdPartySetting calls.
As I said in #15, I'm not sure on where I've used it in scheduler_feeds_processor_targets_alter() and scheduler_i18n_sync_options(), if we have access to getThirdPartySetting method? But the other guys have reviewed it so I'm guessing it's ok.
Comment #26
joshi.rohit100Comment #27
jonathan1055 commentedThis all looks good in general, just a few points:
return ($node->type->entity->getThirdPartySetting('scheduler', 'publish_enable', 0) == 1);we can remove the == 1 as the value returned will be boolean.But overall this is good and I'd like to get it committed soon, as it is holding up progress on #2594615: Automated testing in 8.x [meta]. I can commit the code this evening if you do not have time to make a new patch.
Comment #28
joekers1 & 2. Changes in the patch supplied.
3. I'm not really sure, I thought maybe it's good practice but then there are a couple where we don't supply a default value.
Comment #29
jonathan1055 commentedThanks for this. I'm happy to make further changes for 3 after Pfressnen has reviewed later as he may have a strong opinion on this, but the main changes that this patch solves are vital so I'm going to commit it.
Comment #31
jonathan1055 commentedI have made two small changes from the patch you provided
4. Removed another '== 1', this time from scheduler_node_presave()
if ($type->getThirdPartySetting('scheduler', 'publish_touch', 0) == 1)<5. Remove redundant comment from scheduler_i18n_sync_options()
// $bundle_name holds the content_type.I will mark this as fixed. I think we should discuss the default values for config->get anf entity->getThirdPartySetting in a separate issue.
Thank you all for your input on this. Good to get it done and moving on.
Jonathan
Comment #44
jonathan1055 commentedIgnore the failed patches above. They were queued but not run until the 8.x committed codebase passed all tests. That happened with my commit a few minutes ago, and then the untested patches have suddenly come to life and been run. This issue is already fixed.