Loading cl_block.module +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ function cl_block_cl_component_audit_alter(array &$card_build, Component $compon ) ); } $card_build['table']['#rows'][0][] = in_array($component->getId(), $allowed_components) $card_build['table']['#rows'][0][] = in_array($component->getId(), $allowed_components, TRUE) ? \t('🌕 Generates a block') : \t('🌑 No block'); } src/Form/ClBlockDialog.php +7 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Drupal\cl_block\Form; use Drupal\cl_components\Component\ComponentDiscovery; use Drupal\cl_components\Exception\ComponentNotFoundException; use Drupal\cl_components\Exception\InvalidComponentHookException; use Drupal\Component\Serialization\Json; use Drupal\Component\Utility\Crypt; use Drupal\Core\Ajax\AjaxResponse; Loading Loading @@ -181,6 +182,12 @@ class ClBlockDialog extends FormBase { '#suffix' => '</div>', '#weight' => 5, ]; try { $component_form = $component->invokeHook('form_alter', [$component_form, $form_state]); } catch (InvalidComponentHookException $e) { // The component does not support this hook. It is fine, do nothing. } if (\Drupal::moduleHandler()->moduleExists('token')) { $form['tree'] = [ '#theme' => 'token_tree_link', Loading src/Form/ClComponentForm.php +13 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Drupal\cl_block\Form; use Drupal\cl_components\Component\Component; use Drupal\cl_components\Component\ComponentDiscovery; use Drupal\cl_components\Exception\ComponentNotFoundException; use Drupal\cl_components\Exception\InvalidComponentHookException; use Drupal\Component\Utility\Crypt; use Drupal\Component\Utility\NestedArray; use Drupal\Core\Form\FormStateInterface; Loading Loading @@ -34,15 +35,20 @@ class ClComponentForm { ) { } /** * Builds the form for a component. * * @param array $form * The form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The form state. * @param array $config * The config. * * @return array * The form. * * @throws \Drupal\cl_components\Exception\ComponentNotFoundException */ public function buildForm(array $form, FormStateInterface $form_state, array $config): array { $this->config = $config; Loading Loading @@ -114,6 +120,12 @@ class ClComponentForm { '#token_types' => ['node', 'user'], ]; } try { $form['component'] = $component->invokeHook('form_alter', [$form['component'], $form_state]); } catch (InvalidComponentHookException $e) { // The component does not support this hook. It is fine, do nothing. } return $form; } Loading Loading
cl_block.module +1 −1 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ function cl_block_cl_component_audit_alter(array &$card_build, Component $compon ) ); } $card_build['table']['#rows'][0][] = in_array($component->getId(), $allowed_components) $card_build['table']['#rows'][0][] = in_array($component->getId(), $allowed_components, TRUE) ? \t('🌕 Generates a block') : \t('🌑 No block'); }
src/Form/ClBlockDialog.php +7 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ namespace Drupal\cl_block\Form; use Drupal\cl_components\Component\ComponentDiscovery; use Drupal\cl_components\Exception\ComponentNotFoundException; use Drupal\cl_components\Exception\InvalidComponentHookException; use Drupal\Component\Serialization\Json; use Drupal\Component\Utility\Crypt; use Drupal\Core\Ajax\AjaxResponse; Loading Loading @@ -181,6 +182,12 @@ class ClBlockDialog extends FormBase { '#suffix' => '</div>', '#weight' => 5, ]; try { $component_form = $component->invokeHook('form_alter', [$component_form, $form_state]); } catch (InvalidComponentHookException $e) { // The component does not support this hook. It is fine, do nothing. } if (\Drupal::moduleHandler()->moduleExists('token')) { $form['tree'] = [ '#theme' => 'token_tree_link', Loading
src/Form/ClComponentForm.php +13 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Drupal\cl_block\Form; use Drupal\cl_components\Component\Component; use Drupal\cl_components\Component\ComponentDiscovery; use Drupal\cl_components\Exception\ComponentNotFoundException; use Drupal\cl_components\Exception\InvalidComponentHookException; use Drupal\Component\Utility\Crypt; use Drupal\Component\Utility\NestedArray; use Drupal\Core\Form\FormStateInterface; Loading Loading @@ -34,15 +35,20 @@ class ClComponentForm { ) { } /** * Builds the form for a component. * * @param array $form * The form. * @param \Drupal\Core\Form\FormStateInterface $form_state * The form state. * @param array $config * The config. * * @return array * The form. * * @throws \Drupal\cl_components\Exception\ComponentNotFoundException */ public function buildForm(array $form, FormStateInterface $form_state, array $config): array { $this->config = $config; Loading Loading @@ -114,6 +120,12 @@ class ClComponentForm { '#token_types' => ['node', 'user'], ]; } try { $form['component'] = $component->invokeHook('form_alter', [$form['component'], $form_state]); } catch (InvalidComponentHookException $e) { // The component does not support this hook. It is fine, do nothing. } return $form; } Loading