Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By xpersonas on
I have a custom module. It's FormBase to create a form. And on submit, I post values to an API. All this works. But I want to change the base URL variable (which is used in multiple methods) so that when you on any environment besides live you get a different URL.
I want to figure out the Drupal 8 way of doing this.
class EventSuggestionForm extends FormBase {
private $baseUrl = 'https://www.example.com'; // Needs to be different if not the live site.
private $apiUrl = '/api/v1/';
Can I get some advice?