Make the "id" parameter for the signup block a block setting

Created on 23 November 2023, over 1 year ago

Problem/Motivation

The README.md says:

To provide end user facing facilities for signup and self-service changes,
create a page or panel containing the following blocks:

  • SelfserviceBlock – outputs the SaaS embed that allow a user to change personal and payment data
  • SignupBlock – outputs the SaaS embed that allows a visitor to signup

but for the Signup block the code looks like this:

/**
   * {@inheritdoc}
   */
  public function build() {
    $build = [
      '#cache' => ['max-age' => 0],
    ];
    $id = $this->requestStack->getCurrentRequest()->get('id');

    try {
      if (!empty($id)) {
        $pre_registration_form = $this->utils->config('pre_registration_form', 'Drupal\subman\Form\PreRegistrationForm');
        if (!empty($pre_registration_form)) {
          $build['pre_registration_form'] = \Drupal::formBuilder()->getForm($pre_registration_form, $id);
        }
        else {
          $build['embed'] = $this->submanSync->buildEmbedSignup($id);
        }
      }
      else {
        $build['embed']['#markup'] = $this->t('No id specified. Time: ' . time());
      }
    }
    catch (SubmanWebhookException $e) {
      \Drupal::logger('subman')->error('Exception catched to SignupBlock::build(): ' . $e->getMessage());
      $build['#markup'] = $this->t('An error occured.');
    }

    return $build;
  }

So an id parameter is required in the URL to make the block appear. Otherwise it shows:

Signup block
No id specified. Time: 1700723116

So I don't really understand what kind of ID that should be and why it's needed for a fresh signup.

Can someone help perhaps and document it? Or should we just remove this as it was something special?

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Fixed

Version

1.0

Component

Documentation

Created by

🇩🇪Germany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024