New answers tagged

1

My answer I found in search_api_solr module search_api_solr.api.php file. I used hook_search_api_solr_field_mapping_alter /** * Change the way the index's field names are mapped to Solr field names. * * @param SearchApiIndex $index * The index whose field mappings are altered. * @param array $fields * An associative array containing the index field ...


0

Drupal 8 core patch documentation https://www.drupal.org/files/issues/entity-query-case-2068655-127_0.patch Drupal considers LIKE case insensitive and the following is often used to tell the database that case insensitive equivalence is desired: @code db_select('users') ->condition('name', db_like($name), 'LIKE') @endcode Use 'LIKE BINARY' instead of '...


1

You get NULL for $edit['status'] because the status hasn't been changed. The functions that calls user_save(), which invokes hook_user_presave() contain the following code. // user_profile_form_submit() $account_unchanged = clone $account; entity_form_submit_build_entity('user', $account, $form, $form_state); // Populate $edit with the properties of $...


0

You can use that query string directly with db_query(), with the difference that database table names need to be wrapped in curly brackets. $query = db_query("SELECT p.id, p.name, GROUP_CONCAT(s.name) AS site_list FROM {sites} s INNER JOIN {publications p} ON p.id = s.site_id GROUP BY p.id"); $records = $query->fetchAll(); foreach ($records as $...


0

Like @Kevin pointed out, $type was never set. That was helpful. I believe this works: if($entity->type == 'course') { $entity->some_boolean = 0; $entity->content_status = 665; $entity->course_number = 3; $entity->tag_line = "some other tag line here"; } If you can improve this, please let me know. Much appreciated.


1

If you want to change what is shown on the site front page you can do that under Configure > System > Site information. Enter node/[number] into the Default front page field (replace the [number] with the node ID of the content you want to appear on the front page). If you want to change Content Views to show only a particular node add the Filter ...


0

To Avoid spam words on Webform. Try this module (Drupal 8 & 9) https://www.drupal.org/project/webform_spam_words We can specify the spam keywords, field and error message. It's a simple and lightweight module


1

The latest update contains all of the updates before so going straight to the latest one should be okay and is what is usually recommended. Be sure to backup your site and test the backup on a dev copy. You should update your contributed modules at the same time as some of them may rely on updated versions of Drupal (core). Lastly and very importantly, there ...


Top 50 recent answers are included