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

Context condition for Parent node of node has term #1053

Merged
merged 3 commits into from
Sep 27, 2024

Conversation

kayakr
Copy link

@kayakr kayakr commented Aug 29, 2024

GitHub Issue: Islandora/documentation#2348

  • Other Relevant Links (Google Groups discussion, related pull requests,
    Release pull requests, etc.)

What does this Pull Request do?

Defines a context condition useful for displaying a navigation block for compound objects, by testing to see if the current node's parent has Model=Compound object.

How should this be tested?

On a repository with a compound object with several children, create a context (say, "Compound object navigation") that has condition "Parent node for node has term with URL", set Term=Compound object, Logic=And, Negate=false. As a reaction for test purposes, show block "Context inspector" on the page.

Alternatively, you can choose to create a view block that takes current node id as contextual filter (default content ID from URL), and uses two relationships based on field_member_of to first reference the parent item, then to list items that have the same parent. Display this view block as the reaction in the context above.

If you visit the compound object, you should see no block reaction, but if you browse to the compound object's child node(s) you should see the block reaction.

Documentation Status

  • Does this change existing behaviour that's currently documented?
  • Does this change require new pages or sections of documentation?
  • Who does this need to be documented for?
  • Associated documentation pull request(s): ___ or documentation issue ___

Additional Notes:

Only lightly tested so far, e.g. it should fire if any of the parents of a node with multiple parents has a matching term.

Interested parties

@Islandora/committers

@kayakr kayakr self-assigned this Aug 29, 2024
@kayakr kayakr changed the base branch from master to 2.x August 29, 2024 04:03
@kayakr
Copy link
Author

kayakr commented Sep 11, 2024

Hmm, I don't recommend merging this yet; the condition is effective but when enabled it requires a term be input via block admin UI, and this stops blocks being added that don't require a match to a term of a parent node.

A work-around is to assign a term for the parent node, export config, edit block config yaml to remove the parent_node_of_node_has_term section from the visibility key, then import config.

@seth-shaw-asu
Copy link
Member

[W]hen enabled it requires a term be input via block admin UI, and this stops blocks being added that don't require a match to a term of a parent node.

You can add the condition identifier to this list so it is excluded from the system block placement config form.

Copy link
Member

@seth-shaw-asu seth-shaw-asu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as advertised. 👍

@seth-shaw-asu seth-shaw-asu merged commit c104e45 into 2.x Sep 27, 2024
27 checks passed
@seth-shaw-asu seth-shaw-asu deleted the 2348-parent_node_of_node_has_term branch September 27, 2024 18:11
@kayakr
Copy link
Author

kayakr commented Sep 27, 2024

[W]hen enabled it requires a term be input via block admin UI, and this stops blocks being added that don't require a match to a term of a parent node.

You can add the condition identifier to this list so it is excluded from the system block placement config form.

Ah, thanks for that. I did wonder why some of the Islandora conditions used in contexts didn't appear in the core block layout visibility options. It would be good if that was a config setting, as in my case I'm managing many of these blocks via core block layout admin rather than context...

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

Successfully merging this pull request may close these issues.

2 participants