Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions config/staging/field.field.field_fapi_property.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
{
"_config_name": "field.field.field_fapi_property",
"field_name": "field_fapi_property",
"type": "node_reference",
"type": "entityreference",
"translatable": false,
"module": "node_reference",
"module": "entityreference",
"active": 1,
"locked": 0,
"cardinality": "1",
"deleted": 0,
"entity_types": [],
"settings": {
"referenceable_types": {
"fapi_property": "fapi_property",
"api": 0,
"book": 0,
"changenotice": 0,
"fapi_element": 0
},
"view": {
"view_name": "",
"display_name": "",
"args": []
"target_type": "node",
"handler": "base",
"handler_settings": {
"target_bundles": {
"fapi_property": "fapi_property"
},
"sort": {
"type": "none"
},
"behaviors": {
"views": {
"status": 0
}
}
}
},
"storage": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
"bundle": "fapi_properties",
"label": "FAPI Property",
"widget": {
"weight": "0",
"type": "node_reference_autocomplete",
"module": "node_reference",
"weight": 0,
"type": "entityreference_autocomplete",
"module": "entityreference",
"active": 1,
"settings": {
"autocomplete_match": "contains",
"match_operator": "CONTAINS",
"size": "60",
"autocomplete_path": "node_reference/autocomplete"
"hide_ids": 0,
"path": ""
}
},
"description": "",
Expand All @@ -26,10 +27,10 @@
"display": {
"default": {
"label": "hidden",
"type": "node_reference_plain",
"type": "entityreference_plain",
"weight": "0",
"settings": [],
"module": "node_reference"
"module": ""
}
}
}
16 changes: 8 additions & 8 deletions config/staging/views.view.form_api.json
Original file line number Diff line number Diff line change
Expand Up @@ -1459,7 +1459,7 @@
"empty_zero": 0,
"hide_alter_empty": 1,
"click_sort_column": "nid",
"type": "node_reference_plain",
"type": "entityreference_plain",
"settings": [],
"group_column": "nid",
"group_columns": [],
Expand Down Expand Up @@ -1497,10 +1497,10 @@
"label": ""
}
},
"field_fapi_property_nid": {
"id": "field_fapi_property_nid",
"field_fapi_property_target_id": {
"id": "field_fapi_property_target_id",
"table": "field_data_field_fapi_property",
"field": "field_fapi_property_nid",
"field": "field_fapi_property_target_id",
"relationship": "field_fapi_properties_value",
"group_type": "group",
"ui_name": "",
Expand Down Expand Up @@ -1731,7 +1731,7 @@
"id": "nid",
"table": "node",
"field": "nid",
"relationship": "field_fapi_property_nid",
"relationship": "field_fapi_property_target_id",
"group_type": "group",
"ui_name": "",
"default_action": "not found",
Expand Down Expand Up @@ -1789,10 +1789,10 @@
"required": 0,
"delta": "-1"
},
"field_fapi_property_nid": {
"id": "field_fapi_property_nid",
"field_fapi_property_target_id": {
"id": "field_fapi_property_target_id",
"table": "field_data_field_fapi_property",
"field": "field_fapi_property_nid",
"field": "field_fapi_property_target_id",
"relationship": "field_fapi_properties_value",
"group_type": "group",
"ui_name": "",
Expand Down
18 changes: 18 additions & 0 deletions www/modules/custom/backdropapi/backdropapi.install
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,21 @@ function backdropapi_install() {
'api_search',
));
}

/**
* Switches Reference field to Entity Reference.
*/
function backdropapi_update_7001() {
$entity_ref_field_spec = array(
'description' => 'The id of the target entity.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
);
db_change_field('field_data_field_fapi_property',
'field_fapi_property_nid',
'field_fapi_property_target_id',
$entity_ref_field_spec);

return t('Updated the field_data_field_fapi_property table.');
}
3 changes: 2 additions & 1 deletion www/modules/custom/backdropapi/backdropapi.module
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function backdropapi_form_api_table() {
// Get all properties for this element.
$element_properties = array();
foreach ($element->field_field_fapi_properties as $element_property) {
// @todo needs reworking.
$element_properties[] = $element_property['rendered']['entity']['paragraphs_item'][$element_property['raw']['value']]['field_fapi_property'][0]['#markup'];
}

Expand Down Expand Up @@ -296,7 +297,7 @@ function backdropapi_fapi_check_view() {
$items = paragraphs_item_load_multiple($ids);
$element_node_properties = array();
foreach ($items as $item) {
$property_nid = $item->field_fapi_property['und'][0]['nid'];
$property_nid = $item->field_fapi_property['und'][0]['target_id'];
$property_name = $property_nodes_by_nid[$property_nid]->title;
$element_node_properties[$property_name] = $item;
}
Expand Down
1 change: 1 addition & 0 deletions www/themes/api_borg/template.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ function api_borg_preprocess_paragraphs_item(&$variables, $hook) {
$content = $variables['content'];

if ($variables['bundle'] == 'fapi_properties') {
// @todo needs reworking.
$property = $content['field_fapi_property'][0]['#markup'];
$id_suffix = in_array($property, backdropapi_form_api_elements()) ? '_property' : '';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@

$default_value = '';
if (isset($row->field_field_default_value[0])) {
// @todo needs reworking.
$default_value = $row->field_field_default_value[0]['rendered']['#markup'];
}
$property = '';
if (isset($row->field_field_fapi_property[0])) {
// @todo needs reworking.
$property = $row->field_field_fapi_property[0]['rendered']['#markup'];
$id_suffix = in_array($property, backdropapi_form_api_elements()) ? '_property' : '';
}
Expand Down