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

Best approach for creating content types and handling different styles

Hi,

I'm new to Drupal.  We're converting our current site to Drupal.

Some of our content types have a specific purpose. But, some are sort of generic, the only difference is the styling that is applied to them. Some pages have cards that are larger with text beneath an image and some have text wrapping the image. Some have a background that is slightly different,etc. The users insist on having everything the same in the Drupal site. What is the best approach to creating content types and handling the variations in styling?

Thank you

[SOLVED] hook_ENTITY_TYPE_presave() not working

I'm working on a custom module to update a field "curryear_birthdate" in an entity "Person" in my Drupal 10.2.4 site using the hook_ENTITY_TYPE_presave() construct.  I followed the template that several Drupal guides showed.

I have two problems:

1) The field doesn't get updated; and
2) I put a debugging display in to see what might be the problem and the display is not appearing.

The code for the .module is shown below.

<?php

use Drupal\Core\Entity\EntityInterface;

css and js aggregation breaks my site

Hello,

I am trying to migrate my settings in .htaccess to my vhost.conf. I am also trying to disable mod_rewrite. Apache says you should avoid it. I have one problem. The following rewrite rules in .htacces are neccesary for css and js aggregation to work:

  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ index.php [L]

If I remove them I also have to disable css and js aggregation. Otherwise the site breaks, the menus dissapear.

how to replace a text value with a variable

hello,

I have a paragraph text field where user will enter text.  In between some headers, I want to insert a variable that is created in the subtheme file.  For example, in the paragraph there is :

 Header

paragraphs

{{ my variable }} - I want to put this anywhere within the text.

More text

Initially, I had the variable placed at the end of the paragraph, but I realized that the users will want to place the variable anywhere they want inside the paragraph.

MQLSTATE[42000]: Syntax error or access violation: 1142 INSERT command denied to user when accessing any page with a form

My Drupal 10 website hosted on OVH was functioning normally and everything was working fine.

However now when I try to access any page containing a form, it displays this error, even though I haven't made any changes or modifications:

*The website encountered an unexpected error. Try again later. Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42000]: Syntax error or access violation: 1142 INSERT command denied to user 'xxxxxxx'@'xx.xx.xx.xx' for table 'watchdog': INSERT INTO "watchdog" ...

Using a TH tag in the first position of content row

I'm building a custom module which calls for a table that has TH tags as the first cell in every row of a table.  Be damned if I can figure out  how to make that happen.

<!--break-->

The table.html.twig documentation says:

Each cell contains the following keys:

Pages

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