Skip to content
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

Info file hidden key behaves strangely when containing a value other than TRUE. #5329

Open
philsward opened this issue Oct 22, 2021 · 5 comments

Comments

@philsward
Copy link

philsward commented Oct 22, 2021

#5321 led to a request for update in the documentation page which led to noticing an odd behavior of the "hidden" key in a themes .info file.

If the hidden key is absent, the theme is displayed.

However if the key is set to a null value, the theme disappears.

hidden =

I would expect that if the key is present but a value hasn't been input (ie true or false) then the theme would default to hidden = false, however it is actually defaulting to hidden = true.

So if no key is present: hidden = false. If key is present with no value, hidden = true. This seems counter-intuitive and I am trying to add in the issue for the docs "the default value is hidden = false if the key is missing or value is missing", but I can't say this because the default isn't consistent...

So, what is the correct or expected workflow? Is it right or does it need to change where an absent key means hidden = false and present key with no value (hidden =) is the same thing as hidden = false?

@klonos
Copy link
Member

klonos commented Oct 23, 2021

I believe that hidden = is incorrect syntax. What I'd expect to happen would be to not throw errors (this is not php) but instead the line would being ignored (i.e. be treated as if it doesn't exist in the file).

@philsward
Copy link
Author

philsward commented Oct 23, 2021

but instead the line would being ignored (i.e. be treated as if it doesn't exist in the file).

I didn't think of it in this way, but yeah, that's the workflow I would expect also.

So in reality, no key and a key with no input should act the same way. But they don't. So ideally we need to get an issue going for it?

I would love to get some additional feedback to make sure more are in agreement this is a bug, not an intentional workflow.

@ghost
Copy link

ghost commented Oct 28, 2021

I think the idea is that if you add 'hidden' to your info file, the theme will be hidden. The key/value thing is just syntax.

If you don't want a theme to be hidden, remove the word 'hidden'. Simples.

@jenlampton
Copy link
Member

jenlampton commented Oct 28, 2021

I agree with @BWPanda and @klonos that putting in invalid code is never a good idea, but it is really weird that in this case a NULL value evaluates to TRUE. I agree with @philsward that what's expected is that the project would only be hidden from the UI if the value were set to TRUE.

I think we could implement a quick bug-fix to make that happen. (adding bug-fix label, and will update issue title)

@jenlampton jenlampton changed the title What is the proper workflow of a theme key set to hidden = Info file hidden key behaves strangely when containing a value other than TRUE. Oct 28, 2021
@philsward
Copy link
Author

Re: zoom discussion

The logic might need to be added for modules, layouts etc that use the hidden key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants