RiddleIntegration.php in Thunder 8.4
File
src/Plugin/Thunder/OptionalModule/RiddleIntegration.php
View source
<?php
namespace Drupal\thunder\Plugin\Thunder\OptionalModule;
use Drupal\Core\Form\FormStateInterface;
class RiddleIntegration extends AbstractOptionalModule {
public function buildForm(array $form, FormStateInterface $form_state) {
$form = parent::buildForm($form, $form_state);
$form['thunder_riddle']['riddle_token'] = [
'#type' => 'textfield',
'#title' => $this
->t('Riddle token'),
'#description' => $this
->t('Register a new account at <a href=":riddle" target="_blank">riddle.com</a> and get a token from the Account->Plugins page (you may need to reset to get the first token). To get a free riddle basic account use this voucher "THUNDER_3eX4_freebasic".', [
':riddle' => 'http://www.riddle.com',
]),
];
return $form;
}
public function submitForm(array $formValues) {
$this->configFactory
->getEditable('riddle_marketplace.settings')
->set('riddle_marketplace.token', (string) $formValues['riddle_token'])
->save(TRUE);
}
}