Skip to content

Commit

Permalink
Add link to react json form editor
Browse files Browse the repository at this point in the history
  • Loading branch information
janette authored and fmizzell committed Feb 7, 2020
1 parent b465660 commit 51ba48b
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 1 deletion.
117 changes: 116 additions & 1 deletion modules/custom/dkan_admin/config/install/views.view.dkan_content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- user
- views_bulk_operations
_core:
default_config_hash: sIHLrlWWGhDodotLDzoAJlqrnlv7OKphojbYzgYptFk
default_config_hash: NRDZnPbQCKTmXDMpa6hNSS4dVTbFhvzk2fCeMlZ6y3I
id: dkan_content
label: 'DKAN Content'
module: node
Expand Down Expand Up @@ -414,6 +414,121 @@ display:
plugin_id: field
entity_type: node
entity_field: changed
nid:
id: nid
table: node_field_data
field: nid
relationship: none
group_type: group
admin_label: ''
label: ''
exclude: true
alter:
alter_text: false
text: ''
make_link: false
path: ''
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: false
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: true
click_sort_column: value
type: number_integer
settings:
thousand_separator: ''
prefix_suffix: true
group_column: value
group_columns: { }
group_rows: true
delta_limit: 0
delta_offset: 0
delta_reversed: false
delta_first_last: false
multi_type: separator
separator: ', '
field_api_classes: false
entity_type: node
entity_field: nid
plugin_id: field
nothing:
id: nothing
table: views
field: nothing
relationship: none
group_type: group
admin_label: ''
label: Edit
exclude: false
alter:
alter_text: true
text: edit
make_link: true
path: '/node/{{ nid }}/edit'
absolute: false
external: false
replace_spaces: false
path_case: none
trim_whitespace: false
alt: ''
rel: ''
link_class: ''
prefix: ''
suffix: ''
target: ''
nl2br: false
max_length: 0
word_boundary: true
ellipsis: true
more_link: false
more_link_text: ''
more_link_path: ''
strip_tags: false
trim: false
preserve_tags: ''
html: false
element_type: ''
element_class: ''
element_label_type: ''
element_label_class: ''
element_label_colon: true
element_wrapper_type: ''
element_wrapper_class: ''
element_default_classes: true
empty: ''
hide_empty: false
empty_zero: false
hide_alter_empty: false
plugin_id: custom
filters:
title:
id: title
Expand Down
26 changes: 26 additions & 0 deletions modules/custom/dkan_admin/dkan_admin.module
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,30 @@ function dkan_admin_form_views_exposed_form_alter(&$form, FormStateInterface $fo
'#default_value' => '',
];
}
}

/**
* Implements template_preprocess_views_view_fields().
*/
function dkan_admin_preprocess_views_view_field(&$vars) {
// To access current row entity.
$entity = $vars['row']->_entity;
$entity_id = $entity->id();
$uuid = $entity->uuid->value;

// To access entities from relationship.
// $entities = $vars['row']->_relationship_entities;

if (isset($vars['view'])
&& ($vars['view']->id() == 'dkan_content')
&& ($vars['view']->current_display == 'page_1')) {

if (isset($vars['view']->field) && (count($vars['view']->field) > 0)) {
if ($vars['field']->field == 'nothing' && $entity->field_data_type->value == 'dataset') {
$vars['output'] = [
'#markup' => '<a href="/admin/dkan/dataset?id=' . $uuid . '">edit</a>',
];
}
}
}
}

0 comments on commit 51ba48b

Please sign in to comment.