-
Notifications
You must be signed in to change notification settings - Fork 2
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
Unpublished repeaters items have 2048 instead of 2049 for status #36
Comments
The two statuses are equivalent. In some cases, I'll use them for temporary runtime purposes but don't recall if I'm doing that here or not. In any case, there's no need to worry about the differing statuses, they should be inconsequential. |
Unfortunately it doesn't seem to be inconsequential in this case - a repeater item with 2049 shows as "New", rather than unpublished. If you are creating an unpublished repeater via the API you need to make sure it is set to 2048 and not 2049 or it simply doesn't work as none of content of the repeater is shown. |
@isellsoap - any chance of re-opening this please. I do think there is more to it than Ryan mentioned. I could be wrong of course, but I would really appreciate a little more clarification on my last point. Perhaps @ryancramerdesign will still remember to get back to me, but I know how many Github notifications he must get and it must be hard to keep track of them all. Having it open again will be an unavoidable reminder :) |
Taking a closer look, it does look like FieldtypeRepeater uses the Page::statusOn for some identification. How are you creating your Repeater pages? Make sure you are using one of the built-in methods that are setup for this purpose, i.e.
or this
This is good to do not only for making sure it has the right status for repeaters, but also because it will use existing blank ready pages when available. If you are already using one of these and still seeing the wrong status, please let me know. |
Yeah I noticed that use of statusOn. I guess I thought that the inconsistency was still a little weird. I have put together a one click script that converts a PageTable field to a Repeater or Repeater Matrix field. It converts everything beautifully including all fields, templates, and of course the content of each of the item sub-pages. The thing is that I am not using Anyway, I have a working solution and as long as you are happy, then I guess this isn't really a problem. |
Sorry @ryancramerdesign - more thoughts on this - it currently seems impossible to use either of these on a repeater item, even if they were created via the admin GUI:
Am I missing something? |
Adrian, check out the comments at the top of the FieldtypeRepeater.module file, it has a few notes in there about how Repeater pages use Page statuses and what the different combinations mean. I'm not positive this is the reason for what you are seeing, so you might also want to double check that the repeater items originated from an unformatted value (i.e. outputFormatting == false). |
@adrianbj Does @ryancramerdesign’s suggestion fix this issue for you? Can it be closed? |
I agree with @adrianbj that this behavior is inconsistent and quite confusing. Running $repeaterItem->addStatus(Page::statusUnpublished) should really unpublish the item. Without having to remove statusOn, that is. It would be great if this were fixed, especially since Repeaters seem to receive an overhaul at the moment anyway. Apart from that, @ryancramerdesign and all collaborators, ProcessWire is a totally awesome system. Thanks a lot for it! |
@adrianbj Hi Adrian, I note this issue is quite old now, is it still relevant or has it been fixed/superseded? |
Hey @netcarver - I think it's a still a mess that needs cleaning up - it's a weird exception which makes API manipulation not work as expected. It certainly hasn't been fixed AFAIK. |
I can confirm this is still an issue. Even if you create the repeater item with the admin, to unpublish via api you must do this or it doest work right: $l->addStatus(Page::statusUnpublished); |
Thanks for your input @joer80 - this has been around for a long time :) |
@joer80 you've got it mostly right but you'll want to set the status directly rather than using addStatus/removeStatus calls. That's because addStatus/removeStatus are what you want to use when you want to add or remove some status without affecting other statuses that might be present. That's not what you want here since repeater combines the unpublished status with others to mean different things (see here), which likely don't apply to your API usage. (Though it's good to know what they are, just in case they are useful for your purpose). So to unpublish, keep it simple and just set the status directly:
or to publish set status to 0 (no status) or 1 (statusOn flag):
|
Short description of the issue
As per the title
Expected behavior
I would expect that unpublished repeater items would also have StatusOn(1) and therefore be 2049.
Actual behavior
They end up with 2048
Optional: Suggestion for a possible fix
Not sure if this needs a fix because I don't really know if it's intended or not. It seems inconsistent to me, but I am guessing there is a valid reason, so maybe this is more of a question that an issue, but I am not sure.
The text was updated successfully, but these errors were encountered: