I unwittingly duplicated features_clone in #887314: Enable cloning of feature. A piece there that's not yet in features_clone is string replacement to essentially clone components.
Say you have a content type, 'article', that's included in a view, 'article', and has a context, 'article-content-type', triggered by display of node type 'article', etc. Merely cloning the feature will get a new article feature, but some text replacement could get e.g. a baseline blog feature. Then again, it could break things, e.g., if used on a 'video' feature that included a dependency on the 'emvideo' module.
I'll be using this functionality in the Debut features set.
Comments
Comment #1
irakli commentedHi,
thanks for letting me know.
A better name-replacement than str_replace() has already been identified as a weak point. I would love to try integrate what you have.
Do you mind if I add you as a co-maintainer of this module and we can try to fix this shortcoming based on your code?
Thanks!
Comment #2
irakli commentedComment #3
nedjoI haven't looked further at this question. I used simple string replacement, so it's not going to be an improvement there on what you did. The potential enhancement would be in extending cloning to features components. I suspect, though, that this would really be useful only as a templating approach that used tokens for replacement to ensure only target strings are replaced.
Comment #4
autopoietic commentedI also duplicated some of this functionality (accidentally) in a script that I wrote to clone a feature and its (single) content type.
I did not make this into a drush function, instead I have it as a local script (that I run in OSX terminal), but I have attached it in case it is of any use.