In "Authors" you can assign a role to all contributors. Regardless of which role I assign, contributors will still appear as Authors, which is wrong. As far as I can see, there's no function yet to show the role of authors. I would expect a table row for each role with the assigned contributors.

I would also suggest to rename the tab "Authors" in the edit menu to "Contributors".

In the attached images you can see how I assigned two contributors, one as author, the other as editor and that they appear as Authors in the table. They will also appear as authors in the Citation.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

plepe created an issue. See original summary.

antongp’s picture

Category: Bug report » Feature request
plepe’s picture

I now somehow solved this issue by creating fields for Editors and Advisors (we don't need other roles) and copying the data in the database. This might not be the best solution, but I wanted to share mine, as long as there's no other.

You can find code changes in the attachment, these are the database queries:

CREATE TABLE `bibcite_reference__editor` (
  `bundle` varchar(128) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT 'The field instance bundle to which this row belongs, used when deleting a field instance',
  `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'A boolean indicating whether this data item has been deleted',
  `entity_id` int(10) unsigned NOT NULL COMMENT 'The entity id this data is attached to',
  `revision_id` int(10) unsigned NOT NULL COMMENT 'The entity revision id this data is attached to, which for an unversioned entity type is the same as the entity id',
  `langcode` varchar(32) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT 'The language code for this data item.',
  `delta` int(10) unsigned NOT NULL COMMENT 'The sequence number for this data item, used for multi-value fields',
  `editor_target_id` int(10) unsigned NOT NULL COMMENT 'The ID of the target entity.',
  `editor_category` varchar(255) DEFAULT NULL,
  `editor_role` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`entity_id`,`deleted`,`delta`,`langcode`),
  KEY `bundle` (`bundle`),
  KEY `revision_id` (`revision_id`),
  KEY `editor_target_id` (`editor_target_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Data storage for bibcite_reference field editor.';

CREATE TABLE `bibcite_reference__advisor` (
  `bundle` varchar(128) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT 'The field instance bundle to which this row belongs, used when deleting a field instance',
  `deleted` tinyint(4) NOT NULL DEFAULT '0' COMMENT 'A boolean indicating whether this data item has been deleted',
  `entity_id` int(10) unsigned NOT NULL COMMENT 'The entity id this data is attached to',
  `revision_id` int(10) unsigned NOT NULL COMMENT 'The entity revision id this data is attached to, which for an unversioned entity type is the same as the entity id',
  `langcode` varchar(32) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT 'The language code for this data item.',
  `delta` int(10) unsigned NOT NULL COMMENT 'The sequence number for this data item, used for multi-value fields',
  `advisor_target_id` int(10) unsigned NOT NULL COMMENT 'The ID of the target entity.',
  `advisor_category` varchar(255) DEFAULT NULL,
  `advisor_role` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`entity_id`,`deleted`,`delta`,`langcode`),
  KEY `bundle` (`bundle`),
  KEY `revision_id` (`revision_id`),
  KEY `advisor_target_id` (`advisor_target_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Data storage for bibcite_reference field advisor.';

insert into bibcite_reference__editor (select bundle, deleted, entity_id, revision_id, langcode, delta, author_target_id, author_category from bibcite_reference__author where author_role='editor');
insert into bibcite_reference__advisor (select bundle, deleted, entity_id, revision_id, langcode, delta, author_target_id, author_category from bibcite_reference__author where author_role='advisor');
delete from bibcite_reference__author where author_role in ('editor', 'advisor');

Things todo: Remove the 'role' column from the new tables.

antongp’s picture

Category: Feature request » Bug report
Priority: Normal » Minor
u_tiwari’s picture

This issue with all roles being treated as Author even if Editor is selected still exists in alpha-10 and dev version, is there any plan to roll out this patch or any other fix for this is already in place?

u_tiwari’s picture

This fixes the issue of all roles being treated as author always because of fixed contributorKey in `bibcite_entity.normalizer.reference` service.
Seems to work fine with citeproc.

u_tiwari’s picture

Version: 8.x-1.0-alpha7 » 8.x-1.x-dev
antongp’s picture

Status: Active » Needs work
Related issues: +#3069985: Endnote import: author category/role

Hi @u_tiwari

Original issue is about different thing, not about what you're trying to fix by patch #6. There is issue report already related to roles/category problem on import: #3069985: Endnote import: author category/role. But the problem is actually more general and affects some other formats, not only EndNote, and affects export as well. So, fix for that issue has to be more general and probably will include new mapping settings.

Re. original issue: patch #3 is not the right way, we're not going to add new base fields to the Reference entity type to fix this. I think there'll be individual fix for Table view only, on theming level (preprocess hook + template). For more general case, we'll probably add more formatters for Contributor field type which will provide more flexibility, but not sure for now.

Thanks.

u_tiwari’s picture

Thanks for the reply. This patch has more to do with citation view mode display for `csl` format. When the citation is rendered on Entity view page we get this array where editor key is empty and gets included in authors ss
And if applying that patch we get the correct author types with desired keys
ss
I agree we might need more work on this but this seemed a simple fix for citation view mode.

antongp’s picture

Ah, yes, you're right. Citation output is also affected since it uses serialization as well. But table output and citation output will be fixed in different ways, and citation problem is more general and there are a few more issues related at some degree.

Thanks!

jrochate’s picture

Hi.

I had to adapt the patch in #6 to test for empty $author['role'] because prior to saving after patch this info is not available and we stick to the default method of $attributes[$this->contributorKey] = $authors;

I'm not sending the patch to not confuse future users, because this does not happen when we save new records AFTER this patch.
But existing information may be need to be checked and default to previous condition that this patch removes.

thanks.

This is important stuff, because without it the CSL doesn't process authors and editores correctly,

robcast’s picture

I also applied @u_tiwari's patch in #6 and now the editor of a chapter in an edited book is no longer shown as author in the CSL output.

It is still missing the "ed." it should get according to the chicago style.

@antongp: it seems you are saying that this is the wrong way to fix it. Is there a better way?

Thanks

  • antongp committed 8ba7514 on 8.x-1.x
    Issue #3006180 by plepe, u_tiwari: Editors and other roles shown as...
antongp’s picture

Pushed a hotfix. Mapping is hardcoded for now, but should help with editors and some other roles.

@robcast

It is still missing the "ed."

With the hotfix, it's still missing for me with Chicago on clean installation. But American Medical Association style has it. I achieved "ed." with Chicago by editing "secondary-contributors" macro in the CSL (by setting form="short" instead of verb on label), though still not sure if it's an issue with the CSL style or processor library.

robcast’s picture

@antongp thanks for the quick fix!

I do have a problem when I try to use the latest 1.x-dev though:

Error: Uncaught TypeError: Argument 1 passed to Drupal\serialization\Normalizer\EntityNormalizer::__construct() must implement interface Drupal\Core\Entity\EntityManagerInterface, instance of Drupal\Core\Entity\EntityTypeManager given, called in /var/www/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php on line 262 and defined in /var/www/docroot/core/modules/serialization/src/Normalizer/EntityNormalizer.php:30
Stack trace:
#0 /var/www/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(262): Drupal\serialization\Normalizer\EntityNormalizer->__construct(Object(Drupal\Core\Entity\EntityTypeManager))
#1 /var/www/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(495): Drupal\Component\DependencyInjection\Container->createService(Array, 'private__6NzsmS...')
#2 /var/www/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(508): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#3 /var/www/docroot/core/lib/Drupal/Componen in /var/www/docroot/core/modules/serialization/src/Normalizer/EntityNormalizer.php, line 30

Could it be a problem with my installation? When I try to do the "drush updb" I get an error:

 [notice] Update started: bibcite_entity_update_8014
 [error]  Error: Call to undefined method Drupal\Core\Entity\EntityDefinitionUpdateManager::updateFieldableEntityType() in bibcite_entity_update_8014() (line 606 of /var/www/docroot/modules/contrib/bibcite/modules/bibcite_entity/bibcite_entity.install) #0 /var/www/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(190): bibcite_entity_update_8014(Array)
antongp’s picture

Which Drupal core version do you use? Seems like not newer than 8.6.x , because EntityNormalizer::__construct() signature change as well as EntityDefinitionUpdateManager::updateFieldableEntityType() method addition happened in Drupal 8.7.0.

We basically keep latest dev compatible with supported Drupal core versions, i.e. Drupal 8.7.x and 8.8.x at the moment, compatibility with unsupported versions is not guaranteed. Fun fact: there are a few workarounds in the code already to make the module compatible with both supported Drupal core branches (these workarounds can be removed once Drupal 8.9/9.0 is released). BibCite alpha10 should be compatible with Drupal 8.6, 8.7 and 8.8.

Hope this helps.

robcast’s picture

@antongp sorry, I didn't specify my Drupal version. Yes it's 8.6.

I am working on the upgrade to 8.7 and I'll try again.

robcast’s picture

@antongp I am on 8.7.11 now and I can install bibcite-1.x and it works!

The editor is recognized by the CSL now. I have to try out your fix to get the "ed." into Chicago style...

Can I use the current bibcite-1.x in low-volume production, or are there known issues?

Thanks!

antongp’s picture

Can I use the current bibcite-1.x in low-volume production, or are there known issues?

I believe there are no new issues added in latest dev in comparison with alpha10. I would start with latest dev because of all nice changes happened since alpha10 (revisions support, UI improvements, etc... You can find full list of changes in the changelog https://git.drupalcode.org/project/bibcite/blob/8.x-1.x/CHANGELOG.md)

robcast’s picture

@antongp I am using 1.x-dev now and it works well!

Thanks a lot!

robcast’s picture

@antongp in #14 you mentioned that you have been able to get the Chicago style to insert "ed." for the editor of a book chapter.

I tried to replicate your fix by changing the label in the secondary-contributors macro but it does not work for me. I have the editor as category=secondary and role=editor.

Could you post the patched style?

The "ed." does work with the AMA style, as you noted.

Thank you.

antongp’s picture

FileSize
21.09 KB

@robcast sorry for late response. Attached edited chicago_author_date style markup. I edited "secondary-contributors" macro.

robcast’s picture

Thanks @antongp! Your style did not exactly what I wanted (editor for chapter type as secondary author) but it showed me that it could work and I found that I needed to change the "verb" in "container-contributors" instead :-)