πŸ‡§πŸ‡·Brazil @igorgoncalves

Account created on 19 April 2011, about 13 years ago
  • Drupal Senior Developer at ImageXΒ 
#

Recent comments

πŸ‡§πŸ‡·Brazil igorgoncalves

@oliverpolden i got the same issue as you but end up working without no patch.
you can just use the regular option "A date in any machine readable format. CCYY-MM-DD HH:MM:SS is preferred."

and set the field value as: Y

πŸ‡§πŸ‡·Brazil igorgoncalves

The content is accurate.
I also checked the code into my test enviroment (D10.1.6).

πŸ‡§πŸ‡·Brazil igorgoncalves

Any progress with this issue @motren-37?
I just faced that very same problem after D10 and CK5 upgrade. Im looking to it.

πŸ‡§πŸ‡·Brazil igorgoncalves

At: 
https://www.drupal.org/docs/administering-a-drupal-site/security-in-drup... β†’

I suggest change the db_like($user) good practice example for the D10 current one: escapeLike()

As the documentation explain right below the example, db_like method were removed since D9 to use escapeLike.

So, basically we are showing to the user an example that its not used at the latest core version, and at the bottom we are saying they should use a new improved version.

πŸ‡§πŸ‡·Brazil igorgoncalves

Fixing a typo.

πŸ‡§πŸ‡·Brazil igorgoncalves

Ok, i faced a similar situation like many others here, so i will share the step-by-step i made to achieve the solution.

1 - We have a product content type with a product_id field. So the editor wants to search not only by the product title, but by the product id as well.

2 - On yours custom module you will need to create a new Linkit Matcher.

3 - so, o my 'custom_module' i created:

docroot/modules/custom/custom_module/src/Plugin/Linkit/Matcher/NodeProductsMatcher.php

4 - and the code below:

<?php
namespace Drupal\custom_module\Plugin\Linkit\Matcher;
use Drupal\linkit\Plugin\Linkit\Matcher\NodeMatcher;

// Those anotations below it is VERY important to follow the patterns from NodeMatcher parent.

/**
 * Provide specific linkit matcher for products CT.
 *
 * @Matcher(
 *   id = "custom_module:node:products",
 *   label = @Translation("Custom Matcher Products"),
 *   target_entity = "node",
 *   provider = "node"
 * )
 */
class NodeProductsMatcher <strong>extends NodeMatcher</strong> {
  /**
   * {@inheritdoc}
   */
  protected function buildEntityQuery($search_string) {
    $search_string = $this->database->escapeLike($search_string);
    $entity_type = $this->entityTypeManager->getDefinition($this->targetType);
    $nodeQuery = $this->entityTypeManager->getStorage('node')->getQuery();
    $nodeQuery->condition('field_product_id', '%' . $search_string . '%', 'LIKE');
    // Bundle check.
    if (!empty($this->configuration['bundles']) && $bundle_key = $entity_type->getKey('bundle')) {
      $nodeQuery->condition($bundle_key, $this->configuration['bundles'], 'IN');
    }
    if ($this->configuration['limit']) {
      $nodeQuery->range(0, $this->configuration['limit']);
    }
    $this->addQueryTags($nodeQuery);
    return $nodeQuery;
  }
}

5 - Save, clear your cache, and go back to UI and add your new Custom Matcher at: admin/config/content/linkit/manage/[Your-profile-default]/matchers

6 - Select the content which have your product_id field, and save.

7 - long story short here, the new NodeProductsMatcher will be called and the buildEntityQuery function there will look for field_product_id, instead of the $node->label() as the default one. The bundle check and the config['limit'] will heritage what you've selected on step 6.

8 - thats it, you now have your suggestions updated.

πŸ‡§πŸ‡·Brazil igorgoncalves

Just changed a misspell word "respond" to "response". At Body field.

Production build 0.69.0 2024