-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add copy article functionality #538
Comments
Hello everybody! We would also be interested to have this feature and are happy to help making it happen. We noticed that there is already some logic in the current version for copying articles so it looks like this feature was already there in an older version of the bundle: PoCWith some hacks it's pretty easy to get it working:
Next steps?
So what do you think? |
Hi, I was wondering if someone could give me a quick feedback. If there is interest I could start working on a PR. |
@rogamoore It would be nice if you could contribute this feature to the bundle. |
👋 Any update on this? |
@mario-fehr @Jelmer7 Please see the "Next steps?" section on my post. I need feedback from someone (Sulu Team) on the two subscribers that are failing. They are not part of the SuluArticleBundle, but of Sulu Core and I have not enough knowledge at the moment to fix this part. |
@alexander-schranz Sorry to ping you, but as we have some time available to contribute to this feature, I would like to ask for a quick opinion/feedback of the Sulu team regarding the above questions. If it's a bad moment, just let me know, otherwise I think it could be a great addition to the next release. |
@rogamoore I think the copy function should be very similar to the snippet copy function which was lately implemented here by @wachterjohannes: https://github.com/sulu/sulu/pull/6859/files. Let me know if you can get it based on https://github.com/sulu/sulu/pull/6859/files get it work also for articles. The The |
@alexander-schranz Thanks for your feedback! I've checked the PR you've linked (https://github.com/sulu/sulu/pull/6859/files) and my changes are pretty much the same (which I think is a good sign) with the difference that after copying the article it's not published immediately, but opened in draft mode. The linked PR also fixes one of my problems mentioned above, where it fails in the So right now there is only one issue left (all other details can be discussed in the upcoming PR).
$route = $this->conflictResolver->resolve($this->chainRouteGenerator->generate($localizedDocument));
if (!$path) {
$generator = $this->routeGenerators[$config['mapping']['generator']];
$path = $generator->generate($entity, $config['mapping']['options']);
}
So now this raises a few questions:
|
So, I found that the reason why # missing
sulu_route:
mappings:
Sulu\Bundle\ArticleBundle\Document\ArticleDocument:
generator: schema
options:
route_schema: '/articles/{implode("-", object)}' The reason is that I have configured the route schema per template as described here: https://github.com/sulu/SuluArticleBundle/blob/2.x/Resources/doc/routing.md#overwrite-route-schema-in-template <property name="routePath" type="route" mandatory="true">
<meta>
<title>sulu_admin.url</title>
</meta>
<params>
<param name="route_schema" value="/{translator.trans('article.routes.events')}/{implode('-', object)}"/>
<param name="mode" value="leaf"/>
</params>
<tag name="sulu_article.article_route"/>
</property> So this raises a new question: If the route schema is defined in the template, how to make sure it's also used when copying an article? Meanwhile I will test the yaml config to see, if I can get past the error with this. |
I can get past the error, when using this mapping (not the default from the docs): sulu_route:
mappings:
Sulu\Bundle\ArticleBundle\Document\ArticleDocument:
generator: schema
options:
route_schema: '/articles/{is_array(object) ? implode("-", object) : object.getTitle()}' Without the default from the docs I'm getting
My next step will be preparing a PR, but I will need some help with this route generating stuff, because IMHO it should work with the default YAML config and also when using the route schema per template config. |
I think this issue can be closed now that #610 has been merged - the feature will be available in the next release (2.5.0 I guess) |
I would like to request a copy article feature. Would be a nice addition to the article bundle.
The text was updated successfully, but these errors were encountered: