Last active
July 30, 2017 05:45
-
-
Save edutrul/a6a3d0da9e17f939165a08516b9cd9bc to your computer and use it in GitHub Desktop.
Implement STATES on drupal8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$formIds = [ | |
'node_location_form', | |
'node_location_edit_form', | |
]; | |
if (in_array($form_id, $formIds)) { | |
$form['#attached']['library'][] = 'care_location/care_location_node_form'; | |
$form['field_location_google_streetview']['#states'] = [ | |
'visible' => [ | |
':input[name="field_location_what_to_display"]' => ['value' => 'field_location_google_streetview'], | |
] | |
]; | |
$form['field_location_images']['#states'] = [ | |
'visible' => [ | |
':input[name="field_location_what_to_display"]' => ['value' => 'field_location_images'], | |
] | |
]; | |
$form['field_location_images_modal']['#states'] = [ | |
'visible' => [ | |
':input[name="field_location_what_to_display"]' => ['value' => 'field_location_images'], | |
] | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment