Problem/Motivation
The Recipe content type has field_author, which is an entity reference to a user. This is not necessary to show an author on an article - Drupal does that automatically based on the author that actually created the article.
The only reason for having a separate field for author is if you have the use case where some authors do not actually use the system but should still be publicly credited. For example if Gordon Ramsay was the author of a recipe, it is unlikely he would be logging in to a CMS to enter the content himself, but he would still expect to be credited.
However this is somewhat of a niche case, and could be misleading to the target audience of Umami; those that don't know Drupal. It could be inferred that this type of field is required for a node to have an attributed author.
It also unnecessarily complecting the demo for a niche case. There are other places where we demonstrate use of an entity reference field.
Proposed resolution
Remove the field. Use the node author instead.
Remaining tasks
All the things.
User interface changes
TBD.
API changes
None.
Data model changes
Remove field_author from recipe content type.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | 2991473-16.patch | 8.37 KB | Vidushi Mehta |
Comments
Comment #2
markconroy commentedWe created this originally to link to an "author" content type, so we could:
Since it's not being used (and is only referencing the user field anyway, let's remove it. We can add it again later if we have enough content to justify it.
Comment #3
markconroy commentedHere's a patch to remove the field_author from the recipe content type.
Comment #4
nickdickinsonwildeAll field configuration has been removed and looks good.
However 2 related files still mention/expect it:
The author in the recipes.csv could probably be left as long as it isn't used/checked in InstallHelper::importRecipes()
Comment #5
jaykandariAgree with @NickWilde.
Tested on local. Works fine for me. No issues during install. Recipe page looks okay.
The only change I'd recommend would be to remove Line no. 205 in
InstallHelper::importRecipes(). If the whole 202-206 section is removed then.. the recipes would be authored as an anonymous. The Article & basic content imports have their "UID" setup.Comment #6
eli-tWe need to keep this in the CSV so that we can set the author to the user when importing content.
Comment #7
nickdickinsonwildeThen as Jay said, just removing line 205 from
InstallHelper::importRecipes()should be adequateComment #8
eli-tRaised #2991895: Remove the Umami user from the Umami demo to remove the Umami user as a follow up.
Comment #9
rahulrasgon commentedComment #10
rahulrasgon commentedHello everyone,
Here is the patch to resolve the above mentioned issue.
Comment #11
jaykandariHi @rahulrasgon,
#10 does the required changes. But it does not Include #3. Coul you please re upload a new patch including changes of both #3 and #10?
Thanks !!
Comment #12
markconroy commentedHere's a patch that combines #3 and #10 and also an interdiff.
Comment #13
jaykandari#12 works perfect !! Thanks @markconroy! Marking it as RTBC.
EDIT: There are some comments which need to be corrected. Like we have a same comment repeated thrice "// Set article author." in
InstallHelper.phpwhen setting author for Article, Recipe & Page content types. This doesn't seem to be part of the scope of this ticket, or maybe we create a new ticket?Comment #14
rahulrasgon commentedRTBC + 1.
Comment #16
Vidushi Mehta commentedJust a reroll of #12 so that it gets pass again without any error I hope..
Comment #17
jaykandarihi @Vidushi Mehta,
If you could add an interdiff.txt to see the difference since the last patch.
Thanks :)
Comment #18
Vidushi Mehta commentedHi @JayKandari
There's no difference in #12 and #16 its just a reroll of #12 so that the test gets pass again and someone can review.
Thanks :)
Comment #19
nickdickinsonwildeComment #20
alexpottCommitted 6381b01 and pushed to 8.7.x. Thanks!
This looks good. I checked out the comment #13 and the additional work. For me
For me the comment is fine. On a lot of Drupal sites the node uid value is the author - in fact in the template you get author_* variables based on the user entity so this looks good.
I've only committed this to 8.7.x as it is not a bug fix and is a task.
Comment #22
alexpottDiscussed with @Gábor Hojtsy who pointed out that this should be backported to 8.6.x because