Last active
March 20, 2020 07:46
-
-
Save ozin7/ac5ce2d297c870f27b5d3e7d80a20cd3 to your computer and use it in GitHub Desktop.
Drupal 8: Commerce condition form element.
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 | |
| /** | |
| * Implements hook_form_alter(). | |
| */ | |
| function HOOK_form_alter(&$form, FormStateInterface $form_state, $form_id) { | |
| if (in_array($form_id, ['commerce_tax_type_edit_form', 'commerce_tax_type_add_form'])) { | |
| $form['commerce_conditions'] = [ | |
| '#type' => 'commerce_conditions', | |
| '#title' => t('Conditions'), | |
| '#default_value' => [], | |
| '#parent_entity_type' => 'commerce_tax_type', | |
| '#entity_types' => ['commerce_order_item'], | |
| ]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment