- Status changed to Fixed
10 months ago 7:24pm 19 January 2024 Automatically closed - issue fixed for 2 weeks with no activity.
I'm working on a contrib module to extend business rules with commerce ( Commerce Business Rules → ).
When adding the commerce conditions element to the business rules condition mix whenever you enable a rule on the commerce element it triggers with ajax a $form_state->setRebuild();
thus resulting in the following exception:
Exception: The position 0, 0 is not empty. in Drupal\business_rules\Util\Flowchart\Matrix->putElementInPosition() (line 302 of /var/www/html/web/modules/contrib/business_rules/src/Util/Flowchart/Matrix.php).
Add a custom button to the condition form to trigger $form_state->setRebuild();
/**
* Implements hook_form_FORM_ID_alter().
*/
function hook_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_state, $form_id) {
if ($form_id === 'business_rules_condition_edit_form') {
$form['actions']['rebuild'] = [
'#type' => 'submit',
'#value' => t('Rebuild'),
'#submit' => ['_custom_form_submit'],
'#op' => 'rebuild',
'#weight' => 7,
];
}
}
}
function _custom_form_submit(array $form, \Drupal\Core\Form\FormStateInterface $form_state){
$form_state->setRebuild();
}
Fixed
2.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Automatically closed - issue fixed for 2 weeks with no activity.