Closed (fixed)
Project:
CRM Core
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
21 Mar 2016 at 13:20 UTC
Updated:
17 May 2016 at 15:14 UTC
Jump to comment: Most recent, Most recent file
D7 version of CRM core relies on the Name field module to provide default name field. Field is added dynamically every time when a new contact bundle is created.
Add name field as a base field on the contact entity:
- check Name field module (it seems to have a D8 port), check if field type works as expected
- add Name field as a dependency of crm_core_contact
- add "name" base field to the contact entity
- remove all D7 code that was used to dynamically add name field
- provide test coverage that will assure field is there and works correctly
| Comment | File | Size | Author |
|---|---|---|---|
| #43 | add_name_field_to_the-2691491-43.patch | 33.87 KB | thenchev |
| #43 | interdiff-2691491-43.txt | 609 bytes | thenchev |
| #40 | interdiff-2691491-40.txt | 4.02 KB | thenchev |
| #40 | add_name_field_to_the-2691491-40.patch | 33.87 KB | thenchev |
| #38 | contact_view.png | 28.74 KB | thenchev |
Comments
Comment #2
thenchev commentedComment #3
berdirI guess _crm_core_contact_contact_name_base() is related to that, as it defines name functionality and is currently unused.
Comment #4
thenchev commentedHere is some initial code. There is an exception when i try to add a contact. In the name module name_element_pre_render when we checks the cardinality it tries to access the value as an array but we have a Drupal\name\Plugin\Field\FieldWidget\NameWidget.
Also tests are missing.
Comment #6
thenchev commentedThink i we need to commit this dependencies so the test work.
Comment #8
thenchev commentedNot sure how this lines affect activity UI tests.
fail: [Other] Line 33 of modules/crm_core/modules/crm_core_activity_ui/src/Tests/ActivityUiTest.php:
Unable to install modules: module 'crm_core_activity_ui' is missing its dependency module name.
Comment #9
thenchev commentedOf course. This should be green.
Comment #10
thenchev commentedBtw whats planned for the contact entity? The default household and organization don't make too much sense with the default name field settings(format). We need deferment field settings for these bundles. Are we going for field_ui_base_route?
Comment #11
slashrsm commentedTrue. We were discussing to split those in separate entity types for exactly this reason. I'd say add this field to current Contact entity which will become Individual when we switch.
Comment #12
thenchev commentedjust the name and entity dependencies.
Comment #13
slashrsm commentedTest dependencies committed.
Comment #15
thenchev commentedThere is an issue on #2629910: WSOD caused by 'description' as array that causes problems when using name field.
Comment #17
thenchev commentedAs discussed with @slashrsm updated the contact label to return first and last name. Also started with commenting out the tests but there are also some hardcoded urls and I would need to change a lot of code to make the test pass. So maybe it is ok for now to just use the name field for $household_node and $organization_node (left a comment there) until we split the contact into entities? It would be easier to later change them.
The test should fail since there are some not commited issues on name module. Like #2629910: WSOD caused by 'description' as array and #2700377: Call to undefined method on manage display
Comment #19
thenchev commentedSame as #17. Reuploading to see if tests pass now.
Comment #21
mbovan commentedTried the patch and it breaks Collect as we are changing the base field type here which results in property definition mismatch with Name field in CRM Core Match.
Changing to metal genre here. :)
Comment #22
thenchev commentedJust added name to the modules list in the test.
@mbovan Thought to sneak in some names :) don't know about standards here.
Comment #24
mbovan commentedCreated a followup for CRM Core Match #2701979: Update Name field
Comment #25
thenchev commentedThis is just the dependency for crm_core matcher.
Comment #27
thenchev commentedSame as #22.
Comment #29
thenchev commentedShould fix some tests and update matcher for name field.
Comment #30
mbovan commentedNot sure about this check...
Can be removed.
Talked with @Denchev about this.
We are not sure if should have a CRM field per "real" entity field (1:1), or a property per entity field? (See the screenshot below)

Do we want to allow a user to favorize properties of each field (e.g. "family" and "given" in Name field) or we should do the matching for a field (and check all the properties in the background)?
Comment #31
thenchev commentedreroll
Comment #33
thenchev commentedChanged tests and updated match so it only works with the defined property. #30.2 is removed, left #30.1 for now... i can for example remove it completely or check if this->field is defined not sure.
#30.3 created followup #2706203: Matcher form doesn't show properties
Comment #34
mbovan commentedThis change breaks Collect, so I think we should open a followup to update it with the changes here.
Still not sure about #30.1.
Overall, looks good.
Comment #35
slashrsm commented#30.1 looks strange indeed. Let's figure out if we can improve that part.
Also, this will need to update the view after #2703565: Replace contact list builder with a view has landed.
Comment #36
thenchev commentedThe check is actually not rely needed, so i removed it completely, also updated the view. I have a few questions here:
1. I don't see any option in the view to make the name a link to the contact, and we don't have a view operation exposed. A followup on the name module?
2. We have to choose how the click sort works you have to choose one of given, title, family... I set it to family but not sure
3. The exposed filter works when we separate in different properties I don't see an options for both name and family to be in one exposed filter.
There will be test fails but i can fix them when we decide how the view should look and work.
Comment #38
thenchev commentedComment #39
slashrsm commented1. and 3. sound like a Name field follow-up. 2. sounds ok.
Comment #40
thenchev commentedcreated 2 followups #2709299: Combined views filter and #2709295: Link name field to the referenced entity
also there is some schema missing on name module i overlooked last time so when this patch [#2629910]is commited all test should be green.
Comment #43
thenchev commentedOk figured it out. This should fix the view.
Comment #44
mbovan commentedHard to review, but seems like good to go... We will need to update Collect with the changes introduced here.
Comment #46
slashrsm commentedCommitted. Will open follow-up for collect.