This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

How should I provide data to service?

Hello,

I have a question. I would appreciate your answer.

How should I provide data to my service correctly? For example in submitForm:

$this->session->set('var1', $name);
$this->session->set('var2', $count);
$form_state->setRedirect('test.task');

Then I have service where I want access the data from session and save in database. Should I read data from session in controller and pass to service by parameter? I guess no but I don't have any other idea. Regards :)

Slow performance of Drupal 7 site

Dear community

I need some help understading why my website is slow (TTFB), I have installed devel module and I can see that for some reason the semaphore table takes a lot of time deleting/inserting records. As I understand this is part of Drupal core but why is it that slow ? 

What can I do to sort this out ?

Apply codding standards in twig templates programmatically

Hi, I'm creating a series of scripts to programmatically apply durpal coding standards, for "normal" files I've used phpcbf --standard=Drupal and for JS files I've used eslint, which is integrated in drupal's core. Is there any tool to fix the coding errors of twig's templates?

Modal dialog form not reacting to AJAX submit handler

I am creating a custom field widget where a user can click a button and edit some fields in a form inside a dialog modal.

Opening the modal works fine, but I cannot seem to make any buttons inside the modal form react to anything I throw at it.

In the below example, when clicking the "submit" inside the modal form, the "submitAjax" function is not executed, and I receive a standard AjaxResponse in my network debugger. I've tried using different class names "use-ajax" and "use-ajax-submit", I also tied without any.

entity_autocomplete allows multiple value

I have an "entity_reference" field which displays an "entity_autocomplete" form field.

I would like the user to select only one value.

The problem is that the field allows the user to enter multiple values (separated by commas), even though I set the field cardinality to 1 and "Tags" is false by default.

Code:

Connecting to SQL Server View

I need to connect to another database and am planning to use Views Database Connector module to display content from that second database. The second database is a SQL Server View. I configured settings.php to connect to that database but it's not seeing the tables. For testing to make sure my code was working, I connected to another mysql database in a separate server and it worked fine and was able to see the tables from that database through Views Database Connector.

Because this is a View in SQL, do i need additional settings in my configuration? 

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions