Problem/Motivation

Field names like "taxonomy_vocabulary_3" and similar are present through the Svelte files (and also some of the PHP files). This name came from the D7 field name, which was made into the fixtures, but it should be abstracted out into "field_categories" or "categories" or whatever makes more sense, in the front-end.

The only place where names like "taxonomy_vocabulary_3" have a place is inside the code of a plugin, but once this is received from the source of data, it should be transformed into a standardised name for the front-end. There is an example of this transformation here.

Steps to reproduce

Search "taxonomy_vocabulary_3" through the code. There are a few @todo in the code already marking these changes, but not everywhere yet.

Proposed resolution

Refactor front-end so it is abstracted from the source of information. Probably the best file to agree on a "contract" is "src\ProjectBrowser\Project.php".

I would just change the following for now:
* taxonomy_vocabulary_3 = field_module_categories;
* taxonomy_vocabulary_44 = field_maintenance_status;
* taxonomy_vocabulary_46 = field_development_status;

The rest of the names seem sensible, at least for now. And, to be clear, these are OK to stay within the MockPlugin and the fixture data, but not outside of that context.

The only changes needed would be in:
* Svelte files
* src\ProjectBrowser\Project.php
* Plugins calling the above "Project" class

Please ping me here or in slack if this is not totally clear.

Remaining tasks

  • ✅ File an issue about this project
  • ☐ Addition/Change/Update/Fix to this project
  • ☐ Testing to ensure no regression
  • ☐ Automated unit/functional testing coverage
  • ☐ Developer Documentation support on feature change/addition
  • ☐ User Guide Documentation support on feature change/addition
  • ☐ Code review from 1 Drupal core team member
  • ☐ Full testing and approval
  • ☐ Credit contributors
  • ☐ Review with the product owner
  • ☐ Release

User interface changes

None.

API changes

Yes, in a few places.

Data model changes

None.

Release notes snippet

Abstract plugin field names from front end.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

fjgarlin created an issue. See original summary.

srishtiiee made their first commit to this issue’s fork.

srishtiiee’s picture

Status: Active » Needs review
fjgarlin’s picture

Status: Needs review » Needs work

This looks great so far! I tried and it looks promising. Thanks!

Some feedback. There are a couple of places where "taxonomy_vocabulary_3" is still wrongly used:
* svelte/src/ProjectBrowser.svelte line 43 (here) - this is where we pass the parameter to the endpoint.
* src/Plugin/ProjectBrowserSource/MockDrupalDotOrg.php lines 181-182 (here) - this is the plugin reading the request from the above file.
* Also the "MaintanceIcon" element expects an ID. So you need to change this: <MaintainedIcon maintained={project.field_maintenance_status}/> into this <MaintainedIcon maintained={project.field_maintenance_status.id}/>

srishtiiee’s picture

Thanks for the feedback @fjgarlin! I'll remove these leftover references too.

srishtiiee’s picture

Status: Needs work » Needs review
fjgarlin’s picture

Status: Needs review » Reviewed & tested by the community

I reviewed the code and tested it all locally and it looks good. The code refactoring also looks clean, so marking as RTBC. Thanks for the work on this @srishtiiee!

chrisfromredfin made their first commit to this issue’s fork.

chrisfromredfin’s picture

chrisfromredfin’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.