Account created on 14 March 2018, over 6 years ago
#

Merge Requests

Recent comments

πŸ‡΅πŸ‡±Poland Pozi

Problem can be also solved by allowing to provide tid instead of ambiguous taxonomy names.

πŸ‡΅πŸ‡±Poland Pozi

Hello i had the same problem i could not open font color and font background menus. I noticed that some extra code was copied from external editor:

After applying "Remove Format" on this fragment of text both menus have returned to operation.

πŸ‡΅πŸ‡±Poland Pozi

use Drupal\Core\Cache\Cache;
use Drupal\node\Entity\Node;
use Drupal\Core\Cache\CacheBackendInterface;

define('CLINIC_ADDRESS_LOCALITY_CACHE_KEY', 'sql_query_cache_key::field_clinic_address_locality');
define('CLINIC_ADDRESS_LOCALITY_CACHE_TAG', 'sql_query_cache_tags::field_clinic_address_locality');

/**
 * Implements hook_ENTITY_TYPE_update() for node entities.
 */
function soft4net_node_update(Node $node) {
    if ($node->getType() == 'clinic') {
        // Invalidate the custom cache tag.
        Cache::invalidateTags([CLINIC_ADDRESS_LOCALITY_CACHE_TAG]);
    }
}
  
/**
 * Implements hook_ENTITY_TYPE_delete() for node entities.
 */
function soft4net_node_delete(Node $node) {
    if ($node->getType() == 'clinic') {
        // Invalidate the custom cache tag.
        Cache::invalidateTags([CLINIC_ADDRESS_LOCALITY_CACHE_TAG]);
    }
}

/**
 * Function to execute and cache the custom SQL query.
 */
function soft4net_get_cached_query_results__field_clinic_address_locality() {
    $cache = \Drupal::cache()->get(CLINIC_ADDRESS_LOCALITY_CACHE_KEY);
    if ($cache) {
        return $cache->data;
    }
    else {  
        // SELECT DISTINCT `field_clinic_address_locality` FROM `node__field_clinic_address` WHERE 1
        $database = \Drupal::database();
        $query = $database->select('node__field_clinic_address', 'nfca')
            ->fields('nfca', ['field_clinic_address_locality'])
        ;

        // $query->accessCheck(FALSE);
        
        $results = $query->distinct()->execute()->fetchCol();
        // $result = $query->distinct()->execute()->fetchAssoc();
        // $result = $query->distinct()->execute()->fetchAll();

        \Drupal::cache()->set(CLINIC_ADDRESS_LOCALITY_CACHE_KEY, $results, CacheBackendInterface::CACHE_PERMANENT, [CLINIC_ADDRESS_LOCALITY_CACHE_TAG]);
    
        return $results;
    }
}

/**
 * Implements hook_views_pre_view().
 */
function soft4net_views_pre_view(\Drupal\views\ViewExecutable $view, string $display_id, array $args) {
    if ($view->id() === 'clinics' && $display_id === 'clinics_list') {
//         $field_clinic_address_locality_options = $view->getHandler($view->current_display, 'filter', 'field_clinic_address_locality');
// echo '<pre>';
// print_r($field_clinic_address_locality_options);
// echo '</pre>';

        $field_clinic_address_locality_options = [
            "id" => "field_clinic_address_locality",
            "table" => "node__field_clinic_address",
            "field" => "field_clinic_address_locality",
            "relationship" => "none",
            "group_type" => "group",
            "admin_label" => "",
            "plugin_id" => "string",
            "operator" => "=", // "and",
            "value" => "",            
            "group" => 1,
            "exposed" => TRUE,
            "expose" => [
                "operator_id" => "field_clinic_address_locality_op",
                "label" => t('City', [], ['context' => 'Address label']) . ':',
                "description" => "",
                "use_operator" => FALSE,
                "operator" => "field_clinic_address_locality_op",
                "operator_limit_selection" => FALSE,
                "operator_list" => [],
                "identifier" => "field_clinic_address_locality",
                "required" => FALSE,
                "remember" => FALSE,
                "multiple" => FALSE,
                "remember_roles" => [
                    "authenticated" => "authenticated",
                    "anonymous" => "0",
                ],
                "reduce" => FALSE,
            ],
            "is_grouped" => TRUE,
            "group_info" => [
                "label" => t('City', [], ['context' => 'Address label']) . ':',
                "description" => "",
                "identifier" => "field_clinic_address_locality",
                "optional" => TRUE,
                "widget" => "select",
                "multiple" => FALSE,
                "remember" => FALSE,
                "default_group" => "All",
                "default_group_multiple" => [],
                "group_items" => [
                ],
            ],
        ];

        // $field_clinic_address_locality_options['group_info']['group_items'] = [];

        $results = soft4net_get_cached_query_results__field_clinic_address_locality();
        array_walk($results, function($city, $key) use (&$field_clinic_address_locality_options) {
            $field_clinic_address_locality_options['group_info']['group_items'][$city] = [
                "title" => $city,
                "operator" => "=",
                "value" => $city,
            ];
        });

        $view->addHandler($view->current_display, 'filter', 'node__field_clinic_address', 'field_clinic_address_locality', $field_clinic_address_locality_options);
    }

}

πŸ‡΅πŸ‡±Poland Pozi

Hello, as @mrogers said, home page said there's an interactive modal for getting the list of created acnhors, like in CKEditor 4 plugin, you can see it in this presentation video: https://www.youtube.com/watch?v=XFesGHEeKTQ
Right now after creating an anchor "anchor_name" when i want to add link to it i have to manually type in link "#anchor_name", there's no list of anchors from which i can pick one in link creation modal. So we both wondering if we miss something during installation?

πŸ‡΅πŸ‡±Poland Pozi

By using "Drupal\Component\EventDispatcher\Event" minimum version requirement should not be "^8.7.7 || ^9 || ^10" but "^9.1 || ^10".

Or we can introduce similar apporach as web/modules/contrib/commerce/src/EventBase.php commerce module took:

<?php

namespace Drupal\commerce;

// Drupal\Component\EventDispatcher\Event was introduced in Drupal core 9.1 to
// assist with deprecations and the transition to Symfony 5.
// @todo Remove this when core 9.1 is the lowest supported version.
// @see https://www.drupal.org/project/commerce/issues/3192056
if (!class_exists('Drupal\Component\EventDispatcher\Event')) {
  class_alias('Symfony\Component\EventDispatcher\Event', 'Drupal\Component\EventDispatcher\Event');
}

use Drupal\Component\EventDispatcher\Event;

/**
 * Provides a base event class for Commerce events.
 */
class EventBase extends Event {}

πŸ‡΅πŸ‡±Poland Pozi

I made a test with another Provider - Google and it worked so the problem is within provider module - DeepL.

πŸ‡΅πŸ‡±Poland Pozi

So far i managed to establish that hook "tmgmt_content_entity_update()" from tmgmt/sources/content/tmgmt_content.module is not fired when addin content via JSON:API. But at the moment i am not sure where newly created entity update occurs.

Adding new content backtrace:

via JSON:API:
1) tmgmt_content_entity_update() :: entityId: 491, getEntityTypeId: tmgmt_job_item, bundle: tmgmt_job_item, source_langcode: und
Missing hook invokation for just added custom node type "sm_training_unit"!

via CMS interface:
1) tmgmt_content_entity_update() :: entityId: 492, getEntityTypeId: tmgmt_job_item, bundle: tmgmt_job_item, source_langcode: und
2) tmgmt_content_entity_update() :: entityId: 492, getEntityTypeId: tmgmt_job_item, bundle: tmgmt_job_item, source_langcode: und
3) tmgmt_content_entity_update() :: entityId: 46, getEntityTypeId: node, bundle: sm_training_unit, source_langcode: de
4) tmgmt_content_entity_update() :: entityId: 492, getEntityTypeId: tmgmt_job_item, bundle: tmgmt_job_item, source_langcode: und
5) tmgmt_content_entity_update() :: entityId: 492, getEntityTypeId: tmgmt_job_item, bundle: tmgmt_job_item, source_langcode: und

πŸ‡΅πŸ‡±Poland Pozi

It is also worth mentioning that EN is my default language on site. I am aware of JSON:API limitation when it comes to translations creation but as far i understand how TMGMT works, translation is added on Drupal "side" as "reaction" to node creation.
https://www.drupal.org/docs/core-modules-and-themes/core-modules/jsonapi... β†’

πŸ‡΅πŸ‡±Poland Pozi

As quick fix just comment out local task for which dedicated route was removed:
1) file to edit "web/modules/contrib/opigno_learning_path/opigno_learning_path.links.task.yml",
2) entry to comment out/remove:

opigno_learning_path.steps.my_result:
  route_name: opigno_learning_path.steps.finish
  title: 'My result'
  base_route: entity.group.canonical

3) drush cr

πŸ‡΅πŸ‡±Poland Pozi

I had the same error shallow debuging indicates problem in Group module. More can be seen here:
https://www.drupal.org/project/group/issues/3163258 β†’

πŸ‡΅πŸ‡±Poland Pozi

I am new to the topic and was able to add new translation by commenting out those lines from #126 patch:

    if ($resource_langcode !== $parsed_langcode) {
      $message = 'Translation resource language mismatch: "%s" (request metadata) vs "%s" (request payload).';
      throw new UnprocessableEntityHttpException(sprintf($message, $resource_langcode, $parsed_langcode));
    }

@b.khouy you can add transaltion either by using queryParam "lang_code" or by setting POST request "Content-Language", of course both set to translation destination language. Sending PATCH request to whatever entity endpoint language modifies default language.

BTW, "successful" translation adding returned error 500 with details: "Cannot get a version identifier for a non-versionable resource.".

Moreover with enabled jsonapi_translation module JSON:API GET translation stopped working, it always returns default language.

Production build 0.71.5 2024