public function WSDataBlock::blockSubmit in Web Service Data 2.0.x
Same name and namespace in other branches
- 8 modules/wsdata_block/src/Plugin/Block/WSDataBlock.php \Drupal\wsdata_block\Plugin\Block\WSDataBlock::blockSubmit()
Overrides BlockPluginTrait::blockSubmit
File
- modules/
wsdata_block/ src/ Plugin/ Block/ WSDataBlock.php, line 84
Class
- WSDataBlock
- Provides a 'Green House Gas Emissions' block.
Namespace
Drupal\wsdata_block\Plugin\BlockCode
public function blockSubmit($form, FormStateInterface $form_state) {
$this->configuration['wscall'] = $form_state
->getValue('wscall');
// Loop thru the replacements and save them as an array.
$replacement = [];
/* TODO: replace this workflow, this should be all done through the server
and not the config entities directly. */
$wscall = $this->entityTypeManager
->getStorage('wscall')
->load($this->configuration['wscall']);
foreach ($wscall
->getReplacements() as $rep) {
$replacement[$rep] = $form_state
->getValue('replacements')[$rep];
}
$this->configuration['replacements'] = $replacement;
$this->configuration['data'] = $form_state
->getValue('data');
$this->configuration['returnToken'] = $form_state
->getValue('returnToken');
}