Problem/Motivation
I'm using default_content module as a dependency for my custom module which creates different command line tasks for drupal console. I need ability to import data from any folder, not just specific module.
Proposed resolution
I propose to add another parameter to importContent method, which will be null by default and if someone passes that parameter method will ignore $module and use $folder as an export path.
There is another way, we could refactor $module parameter logic so that we specify only folder, this way we will have a freedom to generate content where we want, but it might be conflicting to #2614650
I created a patch, I'll attach it to this issue, hope it makes sense to others too.
Comments
Comment #2
otarza commentedPatch
Comment #3
anil280988 commentedComment #4
otarza commentedComment #5
otarza commentedHi, I created another patch,
I think it will give us ability to use importContent method in a cleaner way, with only one $options argument:
$options argument is an array with the following structure:
Or
This way everyone could have ability to specify where they want to export content.
Comment #7
otarza commentedI made some changes to patch so tests don't fail now.
Comment #8
anil280988 commentedHi otarza,
Whenever you upload the patch, the Status need to be changed to "Needs Review", only after that the patch will be reviewed. Changing the status, thanks for the patch.
Comment #9
snehi commentedCan we wrap it to 80 col. Otherwise look fine set of work.
Comment #10
otarza commentedHello @snehi,
I made changes, this is a new patch which is wrapped in 80 col.
Comment #11
anil280988 commentedHi otarza,
As mentioned before also, you need to change the status of the issue to "Needs review", else it will not be reviewed. Kindly keep that in mind from next time. Thanks for the patch.
Comment #12
otarza commentedanil280988 I cant change status to "Needs review" because looks like I'm not "confirmed" user :|
Comment #13
anil280988 commentedSorry for that @otarza.
To be a confirm user you can apply for the "confirmed" user role via the issue queue. Issue summary can just say 'Please review'.
See the following Link
-- https://www.drupal.org/node/1887616
-- https://www.drupal.org/node/add/project-issue/webmasters?component=User%...
Comment #14
snehi commentedlooks ok to me +1 for RTBC. In future please add interdiff so that we can easily find what has been changed.
Comment #15
anil280988 commentedAny update on this ?
Comment #16
andrewsuth commented+1
Looks ready to merge.
Comment #17
andrewsuth commentedComment #18
larowlanWhy an array of options and not a second option argument?
I'd prefer the later
We need the event in both instances, but it should be a different event.
This means it makes more sense to rename importContent as importContentFromModule and add a new method importContentFromFolder
Also, we need a test if possible, should be able to use drupal_get_path() to the test module and test using the folder
Comment #19
otarza commentedHello,
I considered @larowlan's comment and refactored my patch.
Here is a new patch, containing following changes:
I refactored
importContentmethod a little but I left most of it unchanged, I did this to prevent code duplicates.So now importContent accepts $folder parameter only, not $module.
I also implemented 2 additional methods:
importContentFromModule($module)- accepts $module - machine name of the module.importContentFromFolder($folder)- accepts $folder - the path to import content from.Both methods call
importContent($folder)method.This way module's regular flow stays unchanged, only the name of method is changed when importing content from module.
I also updated
.modulefile andDefaultContentManagerInterfaceaccordingly.Comment #20
otarza commentedComment #22
otarza commentedSorry, my previous patch failed tests, I checked and tested it now locally now it passes.
Find description of this patch above in #19
Comment #23
otarza commentedComment #24
ademarco commentedPatch works well in my case, marking as RTBC.
Comment #25
otarza commentedComment #26
ademarco commentedI've re-rolled patch on #22 working on the following points:
Interdiff between #22 and #26 is also provided.
Comment #27
bircherNice! This is a nice addition!
Comment #28
otarza commented+1 for #26
Comment #29
otarza commentedHello,
I wanted to use #26 but it turned out codebase changed so that I needed to create a reroll.
I'm including the reroll as a patch here, it would be great if we find the way to merge this soon.
I have added this message:
to this reroll, so it will output not only already existed messages but newly created ones.
Comment #30
otarza commentedComment #31
ademarco commentedI've reviewed the re-roll and everything works as expected. Thanks!
Comment #32
otarza commentedI have created another reroll because last one was failing while applying it to latest 8.x-1.x branch.
Comment #35
snehi commentedAnyone working on this ?
Comment #36
andypostThis will be useful with related
Comment #37
ndf commentedAnother reroll on current 8.x-1.x branch.
The reroll is manual, let's see what the testbot says.
Comment #39
ndf commentedComment #41
ndf commentedThe patch applies, but the tests are failing. Try to fix it next days/week.
Comment #42
ndf commentedComment #43
aaronbaumanThis feature would also allow the default content manager to be used, e.g. in an install profile.
Thanks for the patch
Comment #44
ao2 commentedThis could also be useful in relation to manual imports #2640734: [PP-1] Allow manual imports.
For example, the
default-content-export-referenceshas a--folderoption, and an import command could have it too, for symmetry.Comment #45
kalpaitch commentedI think this ticket may have merged with #2824103: default-content-export-references behaves differently than default-content-export which also needs to use the
--folderoption for symmetry.Suggested credits get moved and work gets continued there.
Comment #46
kalpaitch commentedIMO anyway.
Comment #47
bryanmanalo commentedAdding a patch for 2.x branch.
These two issues do not alter the import behavior, only the export behavior.
#2824103: default-content-export-references behaves differently than default-content-export
#2640734: [PP-1] Allow manual imports
For my use case, I need to import from a folder, that is not in a module.