Closed (fixed)
Project:
Commerce Product Reference View Widget
Version:
7.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Feature request
Assigned:
Reporter:
Created:
25 Aug 2011 at 19:19 UTC
Updated:
14 Sep 2011 at 23:51 UTC
Here's the plan:
Every time a product_reference_field switches to a product_reference_view widget we instantiate a "corresponding" viewfield instance.
For example:
a. product_reference_field "field_testa" switches to product_reference_view widget we create a field called field_testa_view
http://drupal.org/node/1256820#comment-4906976
Comments
Comment #1
chriscalip commentedUpdate .info file to add entity api and viewfield module
Comment #2
chriscalip commentedupdate .install schema
a.) remove existing table.
b.) add new schema product_reference_view
columns :
1.)commerce_product_reference (field_id)
2.)view_field(field_id)
3.)status (bool active/inactive)
Comment #3
chriscalip commentedModule Logic and processes for event "Any Change of Widget on field Commerce Product Reference"
search drupal api or entity api
a.) add product_reference_view widget specific stuff to do on event "Any Change of Widget on field Commerce Product Reference"
1.) add/modify record on schema product_reference_view (prv) -- first see if the field id has an existing record on prv , if not create corresponding viewfield instance and name it as [(commerce_product_reference)field_name]_view; add record on prv
$prv = array('commerce_product_reference'=>$cpr_field_id, 'viewfield'=>$viewfield_id,'active');
drupal_write_record($prv);
Reserved Product Reference Source View.
reserved field: field_rsrvd_prdref_srcview
also implement hook_install to create a field type 'viewfield' fieldname => field_rsrvd_prdref_srcview strictly for this module purposes and modify hook_uninstall to drop said field on uninstall process of this module.
Comment #4
chriscalip commentedsearch entity api
alter display properties ( disable ) of any viewfield found active in schema product_reference_view
Comment #5
chriscalip commentedOn node create/edit form on field using widget product_reference_view disable display of field edit element.
create widget property of product_reference_view copy node crud form of commerce_product_reference (hidden).
Comment #6
chriscalip commentedcreate hook_entity_presave/hook_node_presave funnel array of product ids results from source viewfield to 'corresponding' commerce_product_reference
** be sure to refer to schema product_reference_view;
Comment #7
chriscalip commenteddisable and removed any existing settings function for product_reference_view in the field settings form.
We let viewfield handle that part of the puzzle.
settings for this widget is only http://drupal.org/node/1260046#comment-4907274
Comment #8
chriscalip commentedComment #9
chriscalip commentedcreate a no display formatter for the viewfield module; we don't want those corresponding source viewfields to be rendering.
scratch this comment, every field type has a formatter of hidden.
Comment #10
chriscalip commentedon event "Any Change of Widget on field Commerce Product Reference" instead of making use of product_reference_view schema make use of existing drupal resources from field_info_instances.
update logic of node crud form too.
Comment #11
chriscalip commenteddone.