-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wsdata fields & wsdata block #2
Conversation
Modifying the storage controller to be a custom value.
…wsfieldconfig entity type, added the action, the form.
…ace the computed field values with the values returned from the service.
…ty load function.
…routes dynamically the file was not needed.
…entation for the wscall entity.
…http contector and fixed the form.
…and started on the wsdata block module.
…e node type edit page.
* {@inheritdoc} | ||
*/ | ||
public function build() { | ||
// Fetch the wscall. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should use the wsdata service. Also, use dependency injection.
public function blockForm($form, FormStateInterface $form_state) { | ||
|
||
// Load the wscall entities. | ||
$wscalls = entity_load_multiple('wscall'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should write a method for the wscall's to generate their own forms instead of having multiple implementations of essentially the same form.
$options[$wscall->id()] = $wscall->label(); | ||
} | ||
|
||
$form['wscall'] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's that wscall and replacements form again.
$cid_array = array_merge($options, $this->getOptions(), $replacements, $tokens, array('data' => $data, 'key' => $key)); | ||
$cid = md5(serialize($cid_array)); | ||
if ($cache = \Drupal::cache('wsdata')->get($cid)) { | ||
$cache_data = $cache->data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of wrapping the entire contents of this function in an "else", just return early if you have the data in the cache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the return early.
} | ||
|
||
if ($cache_data) { | ||
$this->addData($cache_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are you getting/setting expires times? Are the results permanently cached?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have fixed the caching system ready to be reviewed.
@@ -88,6 +88,7 @@ public function call(array $form, FormStateInterface $form_state) { | |||
foreach ($this->entity->getReplacements() as $replacement) { | |||
$replacements[$replacement] = $form_state->getValue($replacement); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Third place that has the WSCall form.
src/Entity/WSCall.php
Outdated
} | ||
|
||
// Fetch the cache tags for this call and the server instance call. | ||
$cache_tags = array_merge($this->wsserverInst->getCacheTags(), $this->getCacheTags()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where are the encoder and decoders getting applied to the data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Encoders I can't see anywhere where they were implemented? I figure they should be part of the WSCall entity in the Call function that way they can be applied globally ?
Decoders are applied on the WSCall addData & getData function.
} | ||
} | ||
|
||
$form['body'] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Body shouldn't be here. Body is the payload. WSdata->call has a special argument just for it. Also, how would the encoder/decoder get applied?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, I am going to move this into the custom form that way the payload can be modified for each block/field.
- Fixing the caching layer for simple http connector - Removed the body from the connector - Fix the encoder and decoder - Added the encoders on the wscall - Use the services in the block
…potzero/wsdata into wsdata-fields-implementation-8-version Conflicts: modules/wsdata_field/src/Plugin/views/field/WSDataFieldsViews.php
wsdata field implementation
wsdata block implementation
Better header control for the simple http connector.
Implemented the wscall call function