Problem/Motivation
In #2820848: Make BlockContent entities publishable blocks got a publishing status field, but no UI. We should provide a way for users to (un)publish blocks when editing/creating them.
Changes to the block library page have been split off to to #2909435: Update block library page to adapt publishable block content implementation
Proposed resolution
Add the published checkbox to the block edit form like on other editorial content entities.
If a block is unpublished it does not appear.
Remaining tasks
Combine with #2909435: Update block library page to adapt publishable block content implementation (see #106, #107)- Add additional test coverage for the UI implications of what happens if a block content entity is unpublished (see #87)
- Confirm how this impacts translations (see #87)
- Confirm what occurs if a block config entity (placement) references an unpublished block
Consider if we need to add a 'view unpublished' permission per #13- I'm going to say no as I can't think of what usefulness that would be. Or should be a follow up- Reviews
- Manual testing of patch
- Commit
- it will not appear
User interface changes
Yes.
Status checkbox on the block content form
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#176 | 2834546-nr-bot.txt | 90 bytes | needs-review-queue-bot |
#174 | 2834546-nr-bot.txt | 90 bytes | needs-review-queue-bot |
#172 | 2834546-nr-bot.txt | 90 bytes | needs-review-queue-bot |
#170 | 2834546-nr-bot.txt | 12.16 KB | needs-review-queue-bot |
#168 | 2834546-nr-bot.txt | 90 bytes | needs-review-queue-bot |
Issue fork drupal-2834546
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
dixon_Comment #3
dixon_Sorry, can't decide on the title :P
Comment #4
dixon_Comment #5
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedComment #6
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedAttached patch does the following:
Changes to block_content view:
Changes to the block_content form:
Comment #8
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedIt was missing the publish & unpublish actions configuration schemas...
Comment #10
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedComment #12
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedThe rest of the failing tests are probably because this patch requires #2820848: Make BlockContent entities publishable to be in (I hope).
Comment #13
Gábor HojtsyAnother question is whether we need permissions to deal with this? Like "View unpublished content", etc.
Comment #14
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedre #13: we should imho, but now I'm thinking we should tackle this globally for all "unpublishable entities", possibly as part of #2809177: Introduce entity permission providers or?
Comment #16
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedWe should probably follow what's being done on the added related issue, and use a "Published" checkbox instead.
Comment #17
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer commentedPostponing until BlockContent entities are publishable. We should focus for now on that.
Also, #2068063: Change "Save and keep un-/published" buttons to a "Published" checkbox and an included "Save" button is now in, so we must use a checkbox for publishing blocks here.
Comment #19
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation commented#2820848: Make BlockContent entities publishable is getting really close I think, so lets work on this a bit.
First a straight reroll of #8, manually fixed conflicts on:
Comment #20
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation commentedIt's working perfectly already, so that's good news =)
It'd be great if we could get #2892304: Introduce footer region to ContentEntityForm in, to accomodate for the published checbox here as well, for now adding another region like we do on node.
Comment #21
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation commentedSelf review:
Indentation is off here, oops..
Comment #22
timmillwoodUpdating issue summary with latest screenshot.
Comment #23
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation commentedAdded screenshot of the block content view showing the bulk operations for publishing/unpublishing and the new column showing the published state.
Comment #25
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation commentedHere is the combined patch to see what the bot would say.
Comment #27
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedComment #28
Bojhan CreditAttribution: Bojhan as a volunteer and commentedThis was exactly the approach I would propose, following the node method should suffice quite well.
However how do we represent this on the place blocks page, and we should expose it in the contextual sidebar?
Comment #29
timmillwoodRe-roll of #25, before I start trying to fix the issues.
Combined patch includes #148 from #2820848: Make BlockContent entities publishable.
Comment #30
timmillwoodNow to try and fix the test fails.
Comment #31
timmillwoodThis should fix the failing tests and the coding standards issues.
Added [PP-1] because this is really blocked / postponed on #2820848: Make BlockContent entities publishable.
Comment #32
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedWe should have some kind of EntityPublishedActionBase base class for all these action plugins.
We are now displaying the status field in entity form, so this shouldn't be needed anymore?
I'd vote for postponing this issue on #2892304: Introduce footer region to ContentEntityForm as well, no need to introduce code that will be removed shortly after.
#2820848: Make BlockContent entities publishable is removing these definitions because they are already provided by EditorialContentEntityBase, why are we adding them back?
Comment #33
timmillwood#32.1 - Added #2907075: Add EntityPublishedActionBase as a base class for all publishing status actions with we can do as a follow up / soft dependency.
#32.2 - Removed.
#32.3 - I'd kinda hope #2892304: Introduce footer region to ContentEntityForm is committed before this issue, so sounds fair.
#32.4 - Not sure, removed.
Just adding a combined patch for now.
Comment #34
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedThe dependency needed a reroll and #2892304: Introduce footer region to ContentEntityForm was committed so we can fix #32.3 now :)
Comment #35
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation commentedBrilliant, thanks all for pushing this forward!
I think what we've got looks great, only thing I think we should work on (though it could perhaps be a followup), is what Bojhan mentioned on #28:
Some thoughts on this:
Options I see:
(unpublished)
next to the block name, so it looks likeSite branding (unpublished)
(might be too little?).Comment #36
larowlanBlocker is in
Comment #37
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedAwesome thanks @larowlan!
Queued a test for #34 let's see where we stand =)
Comment #38
Wim Leers#2820848: Make BlockContent entities publishable is in.
Comment #39
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedIt doesn't need a reroll, there's a patch in #34 that applies to 8.5.x :) That's why I'm posting two patches every time, with and without the dependent issue.
Comment #40
jibranLet's use
\Drupal\Core\Field\FieldUpdateActionBase
just like\Drupal\node\Plugin\Action\PublishNode
and\Drupal\node\Plugin\Action\UnpublishNode
Comment #41
Wim Leers@amateescu++
@Wim Leers--
Sorry!
Comment #42
Wim Leerss/node/block content/
This is the only thing I'm able to find, and it's a silly nit!
Comment #43
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedYeah latest patch is ok and already passing (was up to date with #2820848: Make BlockContent entities publishable) =)
Addressing #40 and #42.
Comment #44
timmillwoodLooks like we're good to go.
Comment #45
jibranWe are adding two actions and updating an existing view. Do we need an update path to add the actions and update the existing view?
Comment #46
Wim LeersWell spotted, @jibran!
Comment #47
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedAs far as I know, we still don't have a way to update configuration provided by a module (#2684081: Modules need a way to keep their configuration up to date) so I'm not sure there's anything we can do about the existing view.
Comment #48
jibranI think #2898344: Add filters to the comments administration pages is relevant here, see comments #7.2, #9 #10, #11 and #13 in that issue for further details.
TL;DR we didn't add an upgrade path for that view.
But let me quote #10
and #11
This is not going to be in 8.4.x this is just going to be in 8.5.x so by the same logic we don't need an upgrade path for the view.
I asked the upgrade path question in #45 because we are adding two new actions to the existing view if we would have been importing the new view like
comment_post_update_enable_comment_admin_view
then we would have to import the actions as well but is it true here.Let's discuss the two cases:
config/install
would be installed and when the views module is installed we'll install the new updated view fromconfig/optional
.FYI, we need a cache clear post-update hook for this change only.
This change will add an update to EUDM but we only added the status field in #2820848: Make BlockContent entities publishable so we don't need update hook for this.
PS: I think we shouldn't do views and action changes here because this is about updating the UI. We can update the admin view in followup and add actions there because the above discussion seems out of scope here.
Comment #49
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedI took a look to see where we stand when it comes to the
block_content
view moving from 8.4 to 8.5.Steps taken:
git checkout 8.4.x
drush si -y
git checkout 8.5.x
git apply --index 2834546-43.patch
drush updb -y
Result:
The
block_content
view does not show the published column nor the bulk actions to publish/unpublish custom blocks.So clearly the view changes require an upgrade path. I vote for splitting those changes into a follow up, unless someone is willing to do this here...
Comment #50
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedHere is a patch with just the UI changes related to the block content form (no actions or view changes).
I will create the follow up with the view and actions patch shortly.Comment #51
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedWell, before I run and create a follow up, let's hear what others have to say about it, because we could/should also be making changes to the block layout screen.. (see #35), so we may want to split that into another followup perhaps.
In any case, here is the starting point adding what I removed on #50.
Comment #52
dawehnerI think its the right idea to provide an update path:
The update path should update individual bits of the view, aka. set the additional field and add the filters instead of replacing the entire view.
The update path test should then test some basic behaviour of the view.
I just added a follow up issue which would have avoided all this additional code: #2909423: Get rid of BulkForm subclasses when they just override emptySelectedMessage
Comment #53
jibranLet's create a follow-up with whole views related changes then so that we don't block this feature.
Comment #54
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedAlright then, I've opened up the follow up for the view / actions part:
#2909435: Update block library page to adapt publishable block content implementation
Not 100% sure of the issue description there, please review =)
Comment #55
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedNow the patch #50 is simple enough, since we've split off the changes to views.
Comment #56
vijaycs85Here is test to check for the new field (and test-only patch is the diff file).
Comment #59
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedThanks @vijaycs85 for the test!
Just cleaning up unrelated changes to the test file on this patch. Anything else we should be doing here?
Comment #62
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedFixing failing tests...
Comment #64
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedComment #65
timmillwoodShould we postpone this on #2909435: Update block library page to adapt publishable block content implementation?
And maybe on #2809177: Introduce entity permission providers? Do we need any tweaks to
\Drupal\block_content\BlockContentAccessControlHandler
? Should users with the "administer blocks" permission be able to view unpublished blocks?Comment #66
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedRe #65:
As far as postponing on #2909435: Update block library page to adapt publishable block content implementation - We purposely split that into its own issue so as to not to block this one (see #53, #54).
As far as postponing on #2809177: Introduce entity permission providers - If I understand correctly, that adds a
view own unpublished $entity_type
, but nothing related to publishing/unpublishing entities, so I'm not sure how it relates to this issue?Users with
'administer blocks'
permission are already able to view unpublished blocks, and I think this is to be expected. So no need to changeBlockContentAccessControlHandler
in my opinion.Comment #67
timmillwoodOne small item, otherwise looks good:
We don't need to load WebAssert three times, we can use load it once into a variable and use it again.
Comment #68
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedGood point, addressing #67 here.
Comment #69
timmillwoodThanks, looks good
Comment #71
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedFixing failing test.
Comment #72
timmillwoodBack to RTBC then.
Comment #73
catchDoes this need an update for the entity form display, or has that been avoided intentionally? I see discussion about whether or not to update the view here, but not the form display.
Comment #74
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedI don't think there's any reason not to update the form display, good point :) We just need to copy and adapt the code we used for updating form displays for nodes:
node_post_update_configure_status_field_widget()
.Comment #75
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedThanks both, I think that makes sense, hopefully I got it right, adding the update and accompanying test.
Comment #77
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedOops.
Comment #78
timmillwoodThanks @Manuel Garcia
Comment #79
catchWhile in practice form displays should be quite finite, in general we should be batching config updates, since we've had problems with some going out of memory. I think we should do that here even though it's unlikely to be a problem, since it also helps if someone copies and pastes the update to implement their own in a situation that would be a problem.
I've just committed #2949351: Add a helper class to make updating configuration simple which makes that a lot easier to implement.
Comment #80
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedGood idea @catch
Let's see if I got it right :)
Comment #81
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedActually the field placement is simpler nowadays, so adjusting this to be like how we're doing it on other editorial content entities.
Comment #82
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedUpdated issue summary with what we are actually proposing in the patch.
Comment #83
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedComment #84
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedAre you sure about this?
NodeForm
still does it..Comment #85
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedYou're right, its been a while since i looked at this issue... re-uploading #80 for clarity.
Comment #86
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedGreat!
Comment #87
BerdirThat's not that much test coverage on the implications of this. While that technically doesn't change by making it visible, we AFAIK pushed back quite a few questions on this issue when adding the status originally, like:
* No way to see if a block is published or not in the overview nor being able to filter on it
* Weren't 100% sure on whether an admin should see a block with an unpublished block_content entity (right now they can)
* If they can (I guess that makes sense, even though a bit confusing), there is no class nor any resulting visual indication that this element is visible only for users with the administer blocks permission. Nodes have the node--unpublished and the very pretty background color (which I just researched to use a name, but turns out it's not an exact match for anything but close to "Snow"...)
* Translations is also interesting, did we check that the status is then not duplicated? \Drupal\content_translation\ContentTranslationHandler::entityFormAlter() defines a translation status field, which for example \Drupal\node\NodeTranslationHandler::entityFormAlter() hides again. (with one wrong key, see #2971390: Make exposure of translation meta fields conditional, considering to generalize that logic because we actually can do that now)
Are we really sure that we want to expose this functionality to users without having that resolved?
I guess one big advantage would be that users where block_content_8400() failed would have a way to fix their content in the UI, but it will only by in 8.6 anyway ;)
Comment #88
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedWe have an issue for this already: #2909435: Update block library page to adapt publishable block content implementation
So we will need two more issues to handle the visual indication for unpublished blocks throughout the site and another one for the content translation form alter :)
Comment #89
larowlanCan we test the state before the update too?
Just in case someone updates the dump file, which would render this test invalid.
We typically do that
Comment #90
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedGood idea @larowlan, so... something like this would do I suppose?
Comment #92
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedOK now I'm confused... how can it be that the status form component is there before the updates are run? 0_o
Comment #93
BerdirBecause base field default form/view display configuration is merged in from the field definitions if nothing is specified yet.
Second, you are anyway not allowed to use the config entity API before running updates, you must use config API directly. Doing that will also fix the first problem as that config-entity level logic will not run.
Comment #94
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedThanks @Berdir!
Comment #96
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedComment #98
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedComment #99
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedComment #100
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedWe need to bring this in line with what we're doing in #2899923: UI for publishing/unpublishing taxonomy terms and don't update the 'status' component if it already exists on the form display.
Comment #101
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedAddressing #100 :)
Comment #102
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedNice! We still need to work on the followups from #87 / #88, but this is a good small step.
Comment #103
larowlanThis looks ready to go in my book, however I think we need a change record *and* I think @Berdir's concerns in #87/#88 would be semi-addressed if we timed this to go in at the same time as #2909435: Update block library page to adapt publishable block content implementation, which still needs work to address committer feedback on the update path.
Let's get the change record ready to go, and then see how we go on the other one. It would be good to coordinate a commit of this with a subsequent commit of #2909435: Update block library page to adapt publishable block content implementation
Thanks for your work here, this is a big feature.
Comment #104
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedThanks @larowlan - I have created a draft change record, combing the two issues into it, let me know what you think :)
https://www.drupal.org/node/3001390
Comment #105
vijaycs85Tested manually on both scenarios (install with patch & install, apply patch & drush updb) and can see the publish checkbox on both cases. +1 to RTBC.
Comment #106
alexpottThe change record seems to have a screenshot of admin/content and not of the new block content library with publishing status included. I have to agree with @Berdir / #87 - I'm struggling to see how we can be doing this and #2909435: Update block library page to adapt publishable block content implementation in separate issues. Leaving at RTBC for other committers to decide but the CR does look like it needs attention. And if we are going to do them separately then I think we need #2909435: Update block library page to adapt publishable block content implementation close to rtbc to get this in.
Comment #107
catchYes I agree with alexpott, we should combine this issue with #2909435: Update block library page to adapt publishable block content implementation and commit the change together to keep the block UI as a whole consistent.
Comment #108
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedThanks for the great work here. I just encountered, that enabling content translation on a block type and making the "Published" field translatable causes the "Published" field to not save changes anymore, not in the host language, not in the translated ones.
I'm not sure if that is part of the UI issue here, or a bug in the underlying non-ui implementation.
Comment #109
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedReferring to #108, here is a short screencast. Actually the "Published" checkbox is completely effectless on the translated block_content form and the "This translation is published" is the only one working. It seems both have the seem meaning and have side effects on each other.
Comment #110
szeidler CreditAttribution: szeidler at Ramsalt Lab commentedActually I found, that we have the same issue as reported in #108 and #109 also with #2899923-76: UI for publishing/unpublishing taxonomy terms.
I fixed it by using the same approach as in the other issue (thanks for @ManuelGarcia). There might be a better solution, because we're doing the exact same thing then for terms and block content.
Comment #112
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedRerolled, manually fixed conflicts on:
Also trying to fix the tests, interdiff is after the reroll.
Still needs work because it's been requested that we merge #2909435: Update block library page to adapt publishable block content implementation into this one. FWIW, we had previously split that into its own issue so as to not to block this one (see #53, #54).
Comment #114
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedLooks like the interdiff on #110 was incomplete, reverting the changes to changes to core.entity_form_display.block_content.basic.default.yml added in that patch, and adding the fixture yml file back in, hopefully getting this back to green.
A heads up on the patch, not sure why git diff thinks I'm doing this:
I copied core/profiles/standard/config/install/core.entity_form_display.block_content.basic.default.yml over and modified it to create the new file for the fixture...
Comment #116
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedI can't figure out why this test is failing:
Anyone has an idea why?
For now just reverting another unwanted change introduced in #110.
Comment #118
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedOK so I think I finally figured it out... the installed configuration is actually the same as the default, but the order of the items in the file is different, which results in test failure.
I found out by installing
demo_umami
profile, exporting the configuration, and doing a diff between the default file and the exported file.Comment #119
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedThe latest feedback from #107 was that we should combine this issue with #2909435: Update block library page to adapt publishable block content implementation. That's not going to be easy since both of them have 100 comments already, but I guess it can be done :)
@Manuel Garcia, what do you think?
Comment #120
Manuel Garcia CreditAttribution: Manuel Garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedGuess we should merge these two back into one, let's focus on getting a green patch again on #2909435: Update block library page to adapt publishable block content implementation and merge it into here then.
Comment #125
capysara CreditAttribution: capysara at Bounteous commentedIs there any interest in resurrecting this? If so, I can test the last patch (and the patch in https://www.drupal.org/project/drupal/issues/2909435).
Comment #126
amateescu CreditAttribution: amateescu for Tag1 Consulting commentedRerolled the patch from #118 for 9.3.x.
Comment #127
hardikpandya CreditAttribution: hardikpandya as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedRe-rolling the patch in #118 for 9.2.x
Comment #130
smustgrave CreditAttribution: smustgrave at Mobomo commentedStarting at #126
rerolled for 9.5 with a few phpcs fixes.
Comment #132
smustgrave CreditAttribution: smustgrave at Mobomo commentedThis is going to need a heavy code review.
I removed translation and language fields from the core.entity_form in the fixtures folder but kept them in the demo_umami folder because it didn't seem to make sense to remove them for the status field.
Updated one of the failing tests and fixed a deprecation call.
With regards to combining with https://www.drupal.org/project/drupal/issues/2909435 I would vote to keep them separate. That other ticket is far from ready and this one seems closer at least. Easier to get things in smaller chunks then a huge one. Hate to see this feature delayed while we try to fix the other.
Comment #133
larowlanLooking great, a couple of observations
for super-safety we should probably check $form['status'] exists first here.
there will be the odd site that didn't run the update hook properly, or export their config properly and this will cause some oddities in their form/possibly raise warnings
I have no idea about this, so will need to do some research into what this does
is the 8 in the name accurate here now?
nit, > 80 chars in this comment
we can use ->loadUnchanged here and avoid the resetCache call, one less line
not sure about this magic
yeah the 9.0.0 here makes me think we should rename the fixture to be 9 instead of 8 and update the comment
is this a regression?
120 feels high, are these shown below or above the submit button.
I know there's a bug in core that puts all new fields on taxonomy form displays under the button 🤦
Comment #134
smustgrave CreditAttribution: smustgrave at Mobomo commented#133
1. Added an if statement to check
2. Not too sure either. From the original patch
3. Updated to 9
4. Fixed
5. Fixed in 2 spots for that function
6. Wasn't sure either. Is it checking that the status is FALSE? we could just remove and use assertFalse
7. Fixed
8. Possibly? Not sure why it would need to be removed. So added back
9. It appears above the save button
Comment #135
smustgrave CreditAttribution: smustgrave at Mobomo commentedComment #137
smustgrave CreditAttribution: smustgrave at Mobomo commentedbumping
Comment #138
larowlanI re-read all the comments here, and in #106 and #107 we have two committers asking for this to be combined with #2909435: Update block library page to adapt publishable block content implementation
In addition in #87 Berdir had a number of questions about test coverage and the implication for translations which I don't think have been addressed yet.
It also looks like #13 is unresolved
I've updated the issue summary with all those items
Comment #141
smustgrave CreditAttribution: smustgrave at Mobomo commentedMoving over credit from #2909435: Update block library page to adapt publishable block content implementation
Comment #142
smustgrave CreditAttribution: smustgrave at Mobomo commentedCombined the changes from #2909435: Update block library page to adapt publishable block content implementation
Still need work for the additional tests and translation coverage.
@berdir would you mind taking a relook about what could be needed please? Know things have changed in 5 years
I do think we will need a view unpublished permission we may be able to get this ready but ultimately may be blocked by #2809177: Introduce entity permission providers
Comment #143
smustgrave CreditAttribution: smustgrave at Mobomo commentedClosed https://www.drupal.org/project/drupal/issues/2821174 as a duplicate of this.
Comment #144
frankdesign CreditAttribution: frankdesign at Designit commentedMight be worth noting, at the moment it is not possible to create a View of blocks and filter it by 'Enabled'. E.g. if a have a number of Custom Blocks which I have added to my Block Layout and some of them are Enabled and some are Disabled. If I create a View of Custom Blocks and filter them by Published, all the blocks appear in the list as all are considered Published by Views. There is no filter option to filter by Enabled.
Even if I remove a Custom Block from the Block Layout - it will still appear in my Views list.
If this issue is fixed, will it solve this problem too? Or is that a separate problem that I need to create a new issue?
Comment #145
larowlanHi @frankdesign I think you're conflating two different concepts there
We have Block placements - these are config entities that you see at Admin > Structure > Block. These are configured block plugins that include the block-type, the region it is placed in and the theme. They can be blocks made from content (more on that below) but they can also be system blocks like menus, views etc
We also have Block content entities, these are what you see at Admin > Structure > Block > Block Library on 10.0 and below and Admin > Content > Blocks for 10.1 and above.
Block placements can be disabled and enabled
Block content entities can be published and unpublished (and even have drafts).
This is about adding a UI for publishing and unpublishing the block content entities.
They are two different concepts and unfortunately views has no visibility of the block placements which is where the enabled/disabled state comes from. It can only track the content entities.
Comment #147
smustgrave CreditAttribution: smustgrave at Mobomo commentedComment #149
smustgrave CreditAttribution: smustgrave at Mobomo commented1. Add additional test coverage for the UI implications of what happens if a block content entity is unpublished (see #87)
TODO - dependent on answer to 2-4
2. Confirm how this impacts translations (see #87)
Not sure how to verify this. But translation appears to be working
3. Confirm what occurs if a block config entity (placement) references an unpublished block
Updated getEntity() to check status before returning. So unpublished content won't appear.
4. Consider if we need to add a 'view unpublished' permission per #13
Not sure the use case.
Comment #150
smustgrave CreditAttribution: smustgrave at Mobomo commentedUpdated issue summary.
With the changes to the tests I wonder if that covers the change of the block not appearing when status is unpublished.
Putting to review for general feedback.
Comment #151
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #152
smustgrave CreditAttribution: smustgrave at Mobomo commentedMoved logic to blockAccess ready for review again.
Comment #153
savkaviktor16@gmail.com CreditAttribution: savkaviktor16@gmail.com at 1648factory commentedI have rerolled the last version of MR !4213 to D10.1.3 !THIS PATCH DOESN'T CONTAIN TESTS!
Comment #155
smustgrave CreditAttribution: smustgrave at Mobomo commentedHiding patch
Comment #156
larowlanLeft a review on the MR, thanks for picking this up again 🥰
Comment #157
smustgrave CreditAttribution: smustgrave at Mobomo commentedAddressed some feedback. Leaving NW for the open questions and other open threads.
Comment #158
smustgrave CreditAttribution: smustgrave at Mobomo commentedAll threads I believe have been resolved.
Comment #159
borisson_Posted a few nitpicks to the MR, I think @larowlan's questsions have all been answered?
Comment #160
BramDriesenAdded a few nits. Setting to NW for the possible valid todo.
Comment #161
smustgrave CreditAttribution: smustgrave at Mobomo commentedAddressed feedback and cleanup CR.
Comment #162
borisson_I'm not sure if this needs product manager or ux team feedback, but if it doesn't this looks good to go.
Comment #163
lauriiiBased on the number of followers and participants, this seems like a feature that several folks would like to have. I'm not sure I understand when is this feature used and I didn't find any discussion about this from the thread. It would be helpful if folks could comment here / update the issue summary to explain what are the use cases for this feature. 😊
Comment #164
frankdesign CreditAttribution: frankdesign at Designit commented@lauriii
I have a number of blocks on a website that are click button links for membership renewal. The links are to an external third party website, who are handling the actual renewals and payments etc... As a result, I don't have access to publishing/unpublishing those pages/products.
The membership renewal window is only open for a few months each year. So I need to be able to allow content editors to show/hide the blocks with the button links. I don't want the same content editors to have access to the Block Layout page as there are loads of other blocks that I don't want them interfering with. So the only solution that I can see is to be able to publish/unpublish the block as the window open/closes.
At the moment, as site admin, I am managing the visibility of the blocks for them, not ideal but it works. I'd rather that they manage it themselves.
F
Comment #165
mrshowermanRe #163
We use this feature for a kind of "breaking news" block that is displayed on each page on our site.
When the news is outdated, we're unpublishing the block.
Comment #166
lauriiiThank you @frankdesign and @mrshowerman! Based on #164 and #165 +1 on the feature from me. I haven't looked at the actual code though.
Comment #167
smustgrave CreditAttribution: smustgrave at Mobomo commentedJust fyi if there's an issue with the view updates for adding the filters I'm going to just remove those. Based on how I've seen tickets for content view where the view ships with the changes but no update hook for it.
Comment #168
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #169
smustgrave CreditAttribution: smustgrave at Mobomo commentedRebased and removed the update hook for adding filters/columns to existing views. Based on how I've seen issues committed for main content view without update hook believe that's one hurdle we can just remove here.
Comment #170
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #171
smustgrave CreditAttribution: smustgrave at Mobomo commentedRebased
Comment #172
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #173
smustgrave CreditAttribution: smustgrave at Mobomo commentedRebased
Comment #174
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #175
smustgrave CreditAttribution: smustgrave at Mobomo commentedRebased
Comment #176
needs-review-queue-bot CreditAttribution: needs-review-queue-bot as a volunteer commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #178
sakthi_dev CreditAttribution: sakthi_dev at Specbee for Drupal India Association commentedRebased with 11.x and resolved conflicts.
Comment #179
smustgrave CreditAttribution: smustgrave at Mobomo commentedReverted back to before rebase to commit 53e960c6f5e42c0e42cbb24aa727811b817e3236 and rebased from there. Seems there was previous rebase errors even before that so fixed that too
Comment #180
larowlanLeft some comments on the MR
I think we also need to check if we need a views wizard plugin change here, we probably want to add a status = 1 filter by default to any new view of block content entities. But we might not even have a views wizard plugin for block content, so if that's the case, nothing to do