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

Typed Relation #3

Merged
merged 6 commits into from
Aug 29, 2018
Merged

Typed Relation #3

merged 6 commits into from
Aug 29, 2018

Conversation

seth-shaw-unlv
Copy link
Contributor

@seth-shaw-unlv seth-shaw-unlv commented Aug 24, 2018

Adds a TypedRelation Field, Formatter, and Widget. Also adds a Linked Agent field to the Person content type.

Related to issue: Islandora/documentation/issues/889 and Islandora/documentation/issues/893

Testing:

  • Apply the PR
  • Enable the module
  • Create two Persons
  • With the second person, search for the first in the "Linked Agent" field, selecting any relationship type you want, and save.
  • The Person should have a link to the first person on their page with the type of relationship in parentheses. Note: these relationships are not bi-directional (it will not show up on the first Person's page). We can consider is we want to do something about that later.
  • You can also try modifying the field to add new relationships. (I will add more schema.org ones tomorrow.)

Interested parties: @patdunlavey @rosiel @rtilla1

Person's auto_entitylabel config isn't working without the token module.
includes field, widget, and formatter
@patdunlavey
Copy link
Contributor

I'll give it a spin tomorrow!

@seth-shaw-unlv
Copy link
Contributor Author

Oh, yeah. I should have checked the coding standards first... I'll clean those up now.

@patdunlavey
Copy link
Contributor

I ran through the testing steps and can verify that this worked as expected.

I did have trouble upgrading the module in-situ and having the new field appear. I ended up starting with a new vagrant from scratch.

Copy link
Contributor

@patdunlavey patdunlavey left a comment

Choose a reason for hiding this comment

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

These changes worked as expected. I did have difficulty upgrading from the master branch, but the solution for that, an update hook, is not appropriate since there is no release of this module yet!

@seth-shaw-unlv
Copy link
Contributor Author

@patdunlavey yeah, I haven't figured out how to get modules that define content types using configs to uninstall cleanly. Glad there weren't any other problems.

Copy link
Member

@whikloj whikloj left a comment

Choose a reason for hiding this comment

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

One variable to be removed and one question. Otherwise it reads good.

*/
public function viewElements(FieldItemListInterface $items, $langcode) {
$elements = parent::viewElements($items, $langcode);
$values = $items->getValue();
Copy link
Member

Choose a reason for hiding this comment

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

Variable never used, can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah! Yes, that was hold over from a previous strategy.

'type' => 'text',
'size' => 'tiny',
'not null' => TRUE,
];
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand what is going on here. Is this adding in the schema? Could/should this be a yaml file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to the Drupal 8 "Create a custom field type" documentation: "FieldItemInterface::schema() should be overridden, in order to tell the system how to store the value(s) for the field." Every example of custom fields I've seen does it.

@whikloj whikloj merged commit 23d4da6 into Islandora:8.x-1.x Aug 29, 2018
@seth-shaw-unlv seth-shaw-unlv deleted the typed-relation branch August 29, 2018 15:15
@seth-shaw-unlv seth-shaw-unlv restored the typed-relation branch August 30, 2018 20:49
dflitner pushed a commit that referenced this pull request Nov 16, 2020
* merge upstream (#3)

* drupal 9 support

* coding styles
elizoller pushed a commit that referenced this pull request Apr 21, 2021
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.

3 participants