Skip to content
Snippets Groups Projects
Commit fd133593 authored by Eric Bremner's avatar Eric Bremner
Browse files

Issue #3193048: ensuring that we can user services when using ajax

parent d039e843
No related branches found
No related tags found
No related merge requests found
......@@ -67,18 +67,12 @@ class LayoutBuilderIdsConfigureBlock implements EventSubscriberInterface {
];
// Add the form validation for configure block.
$form['#validate'][] = [
$this,
'layoutBuilderIdsConfigureBlockFormValidation',
];
$form['#validate'][] = 'Drupal\layout_builder_ids\EventSubscriber\LayoutBuilderIdsConfigureBlock::layoutBuilderIdsConfigureBlockFormValidation';
// Add our custom submit function.
array_unshift(
$form['#submit'],
[
$this,
'layoutBuilderIdsConfigureBlockSubmitForm',
]
'Drupal\layout_builder_ids\EventSubscriber\LayoutBuilderIdsConfigureBlock::layoutBuilderIdsConfigureBlockSubmitForm'
);
}
}
......@@ -99,7 +93,7 @@ class LayoutBuilderIdsConfigureBlock implements EventSubscriberInterface {
if ($layout_builder_id !== '' && $layout_builder_id !== NULL) {
// Check if we have a duplicate id somewhere.
$found_id = $this->layoutBuilderIdsService->layoutBuilderIdsCheckIds(
$found_id = LayoutBuilderIdsService::layoutBuilderIdsCheckIds(
$layout_builder_id,
$form_state,
'block'
......
......@@ -68,20 +68,14 @@ class LayoutBuilderIdsConfigureSection implements EventSubscriberInterface {
'#description' => $this->t('Section ID is an optional setting which is used to support an anchor link to this block. For example, entering "feature" lets you link directly to this section by adding "#feature" to the end of the URL.</br>IDs should start with a letter, may only contain letters, numbers, underscores, hyphens, and periods, and should be unique on the page.'),
];
// Add our custom submit handler.
// Add the form validation for configure block.
$form['#validate'][] = 'Drupal\layout_builder_ids\EventSubscriber\LayoutBuilderIdsConfigureSection::layoutBuilderIdsConfigureSectionFormValidation';
// Add our custom submit function.
array_unshift(
$form['#submit'],
[
$this,
'layoutBuilderIdsConfigureSectionSubmitForm',
]
'Drupal\layout_builder_ids\EventSubscriber\LayoutBuilderIdsConfigureSection::layoutBuilderIdsConfigureSectionSubmitForm'
);
// Add the form validation for configure section.
$form['#validate'][] = [
$this,
'layoutBuilderIdsConfigureSectionFormValidation',
];
}
}
......@@ -106,7 +100,7 @@ class LayoutBuilderIdsConfigureSection implements EventSubscriberInterface {
$layout_builder_id = Html::getId($layout_builder_id);
// Check if we have a duplicate id somewhere.
$found_id = $this->layoutBuilderIdsService->layoutBuilderIdsCheckIds($layout_builder_id, $form_state, 'section');
$found_id = layoutBuilderIdsService::layoutBuilderIdsCheckIds($layout_builder_id, $form_state, 'section');
// If we have a duplicate id, then set the form error.
if ($found_id) {
......
......@@ -20,8 +20,8 @@ class LayoutBuilderIdsService implements LayoutBuilderIdsServiceInterface {
// Return the found id, which will tell us if we have a
// duplicate id.
return $this->layoutBuilderIdsCheckSectionIds($layout_builder_id, $form_state, $type) ||
$this->layoutBuilderIdsCheckBlockIds($layout_builder_id, $form_state, $type);
return LayoutBuilderIdsService::layoutBuilderIdsCheckSectionIds($layout_builder_id, $form_state, $type) ||
LayoutBuilderIdsService::layoutBuilderIdsCheckBlockIds($layout_builder_id, $form_state, $type);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment