Skip to content
Snippets Groups Projects
Commit af598161 authored by Nicolae Procopan's avatar Nicolae Procopan Committed by David Pascoe-Deslauriers
Browse files

Issue #3107495 by thebumik: Fatal error when adding new web service call

parent 7c162915
No related branches found
No related tags found
No related merge requests found
...@@ -16,6 +16,27 @@ use Symfony\Component\DependencyInjection\ContainerInterface; ...@@ -16,6 +16,27 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/ */
class WSCallForm extends EntityForm { class WSCallForm extends EntityForm {
/**
* WSEncoder Manager.
*
* @var Drupal\wsdata\Plugin\WSEncoderManager
*/
protected $encoderManager;
/**
* WSDecoder Manager.
*
* @var Drupal\wsdata\Plugin\WSDecoderManager
*/
protected $decoderManager;
/**
* Module Handler.
*
* @var Drupal\Core\Extension\ModuleHandlerInterface
*/
protected $moduleHandler;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
...@@ -24,9 +45,9 @@ class WSCallForm extends EntityForm { ...@@ -24,9 +45,9 @@ class WSCallForm extends EntityForm {
WSDecoderManager $plugin_manager_wsdecoder, WSDecoderManager $plugin_manager_wsdecoder,
ModuleHandlerInterface $module_handler ModuleHandlerInterface $module_handler
) { ) {
$this->plugin_manager_wsencoder = $plugin_manager_wsencoder; $this->encoderManager = $plugin_manager_wsencoder;
$this->plugin_manager_wsdecoder = $plugin_manager_wsdecoder; $this->decoderManager = $plugin_manager_wsdecoder;
$this->module_handler = $module_handler; $this->moduleHandler = $module_handler;
} }
/** /**
...@@ -125,7 +146,7 @@ class WSCallForm extends EntityForm { ...@@ -125,7 +146,7 @@ class WSCallForm extends EntityForm {
} }
} }
$decoder_definitions = $this->plugin_manager_wsdecoder->getDefinitions(); $decoder_definitions = $this->decoderManager->getDefinitions();
$options = ['' => $this->t('None')]; $options = ['' => $this->t('None')];
foreach ($decoder_definitions as $key => $decoder) { foreach ($decoder_definitions as $key => $decoder) {
$options[$key] = $decoder['label']->render(); $options[$key] = $decoder['label']->render();
...@@ -140,7 +161,7 @@ class WSCallForm extends EntityForm { ...@@ -140,7 +161,7 @@ class WSCallForm extends EntityForm {
'#default_value' => $wscall_entity->wsdecoder, '#default_value' => $wscall_entity->wsdecoder,
]; ];
$encoder_definitions = $this->plugin_manager_wsencoder->getDefinitions(); $encoder_definitions = $this->encoderManager->getDefinitions();
$options = ['' => $this->t('None')]; $options = ['' => $this->t('None')];
foreach ($encoder_definitions as $key => $encoder) { foreach ($encoder_definitions as $key => $encoder) {
$options[$key] = $encoder['label']->render(); $options[$key] = $encoder['label']->render();
...@@ -155,7 +176,7 @@ class WSCallForm extends EntityForm { ...@@ -155,7 +176,7 @@ class WSCallForm extends EntityForm {
'#default_value' => $wscall_entity->wsencoder, '#default_value' => $wscall_entity->wsencoder,
]; ];
if (!$this->module_handler->moduleExists('wsdata_extras')) { if (!$this->moduleHandler->moduleExists('wsdata_extras')) {
$form['wsdecoder']['#description'] .= ' ' . $this->t('Looking for more decoder plugins? Try enabling the <em>wsdata_extras</em> module.'); $form['wsdecoder']['#description'] .= ' ' . $this->t('Looking for more decoder plugins? Try enabling the <em>wsdata_extras</em> module.');
$form['wsencoder']['#description'] .= ' ' . $this->t('Looking for more encoder plugins? Try enabling the <em>wsdata_extras</em> module.'); $form['wsencoder']['#description'] .= ' ' . $this->t('Looking for more encoder plugins? Try enabling the <em>wsdata_extras</em> module.');
} }
......
...@@ -15,11 +15,18 @@ use Symfony\Component\DependencyInjection\ContainerInterface; ...@@ -15,11 +15,18 @@ use Symfony\Component\DependencyInjection\ContainerInterface;
*/ */
class WSServerForm extends EntityForm { class WSServerForm extends EntityForm {
/**
* Connector Manager.
*
* @var Drupal\wsdata\Plugin\WSConnectorManager
*/
protected $connectorManager;
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function __construct(WSConnectorManager $plugin_manager_wsconnector, MessengerInterface $messenger) { public function __construct(WSConnectorManager $plugin_manager_wsconnector, MessengerInterface $messenger) {
$this->plugin_manager_wsconnector = $plugin_manager_wsconnector; $this->connectorManager = $plugin_manager_wsconnector;
$this->messenger = $messenger; $this->messenger = $messenger;
} }
...@@ -81,7 +88,7 @@ class WSServerForm extends EntityForm { ...@@ -81,7 +88,7 @@ class WSServerForm extends EntityForm {
'#required' => TRUE, '#required' => TRUE,
]; ];
$connector_definitions = $this->plugin_manager_wsconnector->getDefinitions(); $connector_definitions = $this->connectorManager->getDefinitions();
$options = []; $options = [];
foreach ($connector_definitions as $key => $connector) { foreach ($connector_definitions as $key => $connector) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment