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

Issue 1694: node_referenced_by_field condition plugin #808

Merged
merged 4 commits into from
Dec 5, 2020
Merged

Issue 1694: node_referenced_by_field condition plugin #808

merged 4 commits into from
Dec 5, 2020

Conversation

seth-shaw-unlv
Copy link

@seth-shaw-unlv seth-shaw-unlv commented Nov 20, 2020

GitHub Issue: Islandora/documentation#1694

What does this Pull Request do?

Adds a context condition plugin to detect if is a node is referenced by the configured field. It can be used, for example, to determine if a node is referenced by field_member_of, useful for complex objects. It isn't currently used by any islandora contexts in islandora_defaults, but is being made available as a potentially useful condition.

Sidenote: this plugin could be fairly easily modified to also include a count threshold, e.g. is referenced by at least n nodes... but that is a PR for another day.

What's new?

  • Added the aforementioned context plugin.

How should this be tested?

  • Apply the PR
  • clear the cache
  • either modify the collection context to use this new condition with field_member_of, instead of the term-based one, or create a new complex object condition that does something (such as changing the theme).
  • Create a node referenced another node (e.g. "Node A" referenced by "Node B").
  • Visit the referenced node (e.g. "Node A" from before) and observe the configured condition take effect.

Addendum:

  • Visit the block placement UI to ensure it doesn't show up there.

Interested parties

@Islandora/8-x-committers, esp @rosiel.

@rosiel
Copy link
Member

rosiel commented Nov 20, 2020

Seth this is amazing! One thing to mention is that "Node referenced by field" took a while to parse (for someone who didn't know what it was talking about before hand). I know this is a bit more verbose, but maybe

'Node is the target of an entity reference field'
or
'Node is referenced by other entities'
?

@seth-shaw-unlv
Copy link
Author

I suppose we could use "Node is referenced by other nodes" since the form only supplies entity reference fields associated with nodes in the dropdown.

@seth-shaw-unlv
Copy link
Author

Although that isn't strictly accurate, because a node referencing itself would still return true.

@manez
Copy link
Member

manez commented Nov 25, 2020

I like 'Node is referenced by other entities,' from a non-dev perspective. If "Node is referenced by other nodes" is accurate, then that's simpler still, at least for my comfort level with Drupal.

@seth-shaw-unlv
Copy link
Author

I made some changes, @rosiel and @manez. Hopefully that is more clear.

@manez
Copy link
Member

manez commented Dec 1, 2020

👍 from me on the wording.

@mjordan
Copy link

mjordan commented Dec 2, 2020

I'll smoketest this.

@dannylamb
Copy link

Just realizing this now. We'll need to unset this here: https://github.com/Islandora/islandora/blob/8.x-1.x/islandora.module#L410

@mjordan
Copy link

mjordan commented Dec 5, 2020

Works as advertised, doesn't show up in block placement widget, watchdog is clean. Ready to merge.

}
}

}
Copy link

Choose a reason for hiding this comment

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

Reviewed and smoke tested.

@mjordan mjordan merged commit 2a2fbe7 into Islandora:8.x-1.x Dec 5, 2020
@seth-shaw-unlv seth-shaw-unlv deleted the issue-1694 branch December 6, 2020 04:38
seth-shaw-asu pushed a commit that referenced this pull request Feb 1, 2023
…itions' (#925)

There was a cleanup done for this deprecation in #764
before the 'NodeReferencedByNode' condition was made, then the deprecated annotation must have
just been missed in reviewing #808.
rosiel pushed a commit to rosiel/islandora that referenced this pull request Feb 22, 2023
…itions' (Islandora#925)

There was a cleanup done for this deprecation in Islandora#764
before the 'NodeReferencedByNode' condition was made, then the deprecated annotation must have
just been missed in reviewing Islandora#808.
rosiel pushed a commit that referenced this pull request Jul 6, 2023
…itions' (#925)

There was a cleanup done for this deprecation in #764
before the 'NodeReferencedByNode' condition was made, then the deprecated annotation must have
just been missed in reviewing #808.
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.

5 participants