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

part of a fix for https://github.com/Islandora-CLAW/CLAW/issues/1092 #23

Merged
merged 6 commits into from
May 21, 2019

Conversation

elizoller
Copy link
Member

making taxonomy term fields translatable in the default configuration

GitHub Issue: (Islandora/documentation#1092)

What does this Pull Request do?

Make the taxonomy and taxonomy term fields translatable with the default configuration

What's new?

Add yml configuration for language.content_settings.taxonomy_term.[taxonomy_name].yml for corporate_body, family, geo_location, person, resource_types, and subject taxonomies. Add the translatable:true for the following taxonomy term fields in the field configuration: corporate_body.field_cat_date_begin, corporate_body.field_corp_alt_name, corporate_body.field_type, family.field_authority_link, family.field_cat_date_begin, geo_location.field_authority_link, geo_location.field_geo_alt_name, geo_location.field_geo_broader, geo_location.field_geo_geolocation, person.field_authority_link, person.field_cat_date_begin, person.field_cat_date_end, person.field_person_alternate_names, person.field_person_preferred_name, person.field_relationships, resource_types.field_external_authority_link, subject.field_authority_link

How should this be tested?

Copy down the updated config, import controlled_access_terms_default_configuration (ie. drush fim controlled_access_terms_default_configuration). Check to make sure you can translate the terms and fields: http://localhost:8000/admin/config/regional/content-language show demonstrate the taxonomies and fields are checked and able to be translated.

Interested parties

@Natkeeran

… fields translatable in the default configuration
@Natkeeran
Copy link
Contributor

@elizoller Thank you. Works as described.

My only comment here is if date field should be translatable?

@elizoller
Copy link
Member Author

Perhaps not - the thing I could think of would be if by "translating" a date, one might want to reorder like DD-MM-YYYY instead of MM-DD-YYYY - but I think that would already by covered by the Display format settings for that field (ie. /admin/structure/taxonomy/manage/corporate_body/overview/display). I can remove the translation settings for date fields and push that up.

@whikloj
Copy link
Member

whikloj commented Apr 22, 2019

@elizoller will need your CLA signed and on file before we can merge this PR.

@elizoller
Copy link
Member Author

Thanks @whikloj It has been delivered to higher ups for approval.

@manez
Copy link
Member

manez commented May 6, 2019

We now have a cCLA for Arizona State University Library, so this is good to go on that front! @whikloj @Natkeeran

@whikloj
Copy link
Member

whikloj commented May 6, 2019

@Natkeeran you did the testing on this one, so I'll leave it to you for the merge.

@dannylamb
Copy link
Contributor

@Natkeeran ^^

@Natkeeran
Copy link
Contributor

Thanks Danny, will test this soon.

Copy link
Contributor

@seth-shaw-unlv seth-shaw-unlv left a comment

Choose a reason for hiding this comment

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

Please add the content_translation and language modules as dependencies in controlled_access_terms_default_configuration.info.yml.

@seth-shaw-unlv
Copy link
Contributor

I pulled in the PR, imported the Feature changes, added a second language, and tried to create a new Corporate Body record. It WSOD'd and apache reported:

Got error 'PHP message: Uncaught PHP Exception Drupal\\Core\\Entity\\EntityStorageException: "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'content_translation_source' in 'field list':
INSERT INTO {taxonomy_term_field_data} (tid, vid, langcode, status, name, description__value, description__format, weight, changed, default_langcode, content_translation_source, content_translation_outdated, content_translation_uid, content_translation_created)
VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13); Array
(
    [:db_insert_placeholder_0] => 1
    [:db_insert_placeholder_1] => corporate_body
    [:db_insert_placeholder_2] => en
    [:db_insert_placeholder_3] => 1
    [:db_insert_placeholder_4] => ...
', referer: http://as2d8.test/admin/structure/taxonomy/manage/corporate_body/add

Did I miss a step in setup?

@elizoller
Copy link
Member Author

I don't know of a missing step. I'll dig into it later today.

@elizoller
Copy link
Member Author

@seth-shaw-unlv did you do drush fim controlled_access_terms_default_configuration ?
are you seeing the fields as translatable on /admin/config/regional/content-language?

@seth-shaw-unlv
Copy link
Contributor

@elizoller, I know I imported the feature updates and I checked the content translation settings. I thought I saw the fields were translatable. Perhaps I glanced too quickly and was mistaken.

I'm heading out of town today but will try again on Friday.

@seth-shaw-unlv
Copy link
Contributor

Note: I am testing on a DrupalVM site, not an Islandora build.

I enabled the module:

$ drush en -y controlled_access_terms_default_configuration
The following module(s) will be enabled: controlled_access_terms_default_configuration, auto_entitylabel, content_translation, language, controlled_access_terms, name, geolocation, token, field_permissions

 // Do you want to continue?: yes.                                                                                      

 [success] Successfully enabled: controlled_access_terms_default_configuration, auto_entitylabel, content_translation, language, controlled_access_terms, name, geolocation, token, field_permissions

I imported the feature:

$ drush fim controlled_access_terms_default_configuration

 Do you really want to import controlled_access_terms_default_configuration : core.entity_form_display.taxonomy_term.corporate_body.default? (yes/no) [yes]:
 > 

 Do you really want to import controlled_access_terms_default_configuration : core.entity_form_display.taxonomy_term.family.default? (yes/no) [yes]:
 > 

 Do you really want to import controlled_access_terms_default_configuration : core.entity_form_display.taxonomy_term.geo_location.default? (yes/no) [yes]:
 > 

 Do you really want to import controlled_access_terms_default_configuration : core.entity_form_display.taxonomy_term.person.default? (yes/no) [yes]:
 > 

 Do you really want to import controlled_access_terms_default_configuration : core.entity_form_display.taxonomy_term.subject.default? (yes/no) [yes]:
 > 

 Do you really want to import controlled_access_terms_default_configuration : core.entity_view_display.taxonomy_term.geo_location.default? (yes/no) [yes]:
 > 

 Do you really want to import controlled_access_terms_default_configuration : core.entity_view_display.taxonomy_term.subject.default? (yes/no) [yes]:
 > 

 Do you really want to import controlled_access_terms_default_configuration : field.storage.taxonomy_term.field_cat_date_begin? (yes/no) [yes]:
 > 

 Do you really want to import controlled_access_terms_default_configuration : field.storage.taxonomy_term.field_cat_date_end? (yes/no) [yes]:
 > 

 Do you really want to import controlled_access_terms_default_configuration : field.storage.taxonomy_term.field_external_authority_link? (yes/no) [yes]:
 > 

Verified fields were translatable:
Screen Shot 2019-05-17 at 8 36 00 AM

Added a language:
Screen Shot 2019-05-17 at 8 37 00 AM

Attempted to create a Corp Body term:
Screen Shot 2019-05-17 at 8 37 49 AM

But was given a WSOD: The website encountered an unexpected error. Please try again later.

Checked apache error log:

$ tail -n 1 /var/log/apache2/error.log 
[Fri May 17 15:37:54.989616 2019] [proxy_fcgi:error] [pid 28385:tid 140102722361088] [client 192.168.88.1:56393] AH01071: Got error 'PHP message: Uncaught PHP Exception Drupal\\Core\\Entity\\EntityStorageException: "SQLSTATE[42S22]: Column not found: 1054 Unknown column 'content_translation_source' in 'field list': INSERT INTO {taxonomy_term_field_data} (tid, vid, langcode, status, name, description__value, description__format, weight, changed, default_langcode, content_translation_source, content_translation_outdated, content_translation_uid, content_translation_created) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13); Array\n(\n    [:db_insert_placeholder_0] => 1\n    [:db_insert_placeholder_1] => corporate_body\n    [:db_insert_placeholder_2] => en\n    [:db_insert_placeholder_3] => 1\n    [:db_insert_placeholder_4] => ...\n', referer: http://as2d8.test/admin/structure/taxonomy/manage/corporate_body/add

@elizoller
Copy link
Member Author

I did not test on a plain drupal build so I'll go that route. Thanks

@seth-shaw-unlv
Copy link
Contributor

I can confirm it works on an Islandora site. We just need it to work on plain Drupal. Thanks for working on this @elizoller!

@elizoller
Copy link
Member Author

i think that would be because drush feature import wouldn't also enable the required language module?
i tried recreating this by enabling the controlled_access_terms module and the default_config module and then pulling down the changes and doing fim. then adding a corp body term. i didn't encounter the error but i already had language and features installed and enabled.

@seth-shaw-unlv
Copy link
Contributor

Hrm, both the content translation and language modules were enabled as part of the first step, so I don't think that is it. Let me try it again on a fresh box.

@seth-shaw-unlv
Copy link
Contributor

Tried it again and it worked this time. :shipit:

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.

6 participants