🇮🇳India @nitesh624

Ranchi, India
Account created on 25 January 2017, almost 8 years ago
#

Recent comments

🇮🇳India nitesh624 Ranchi, India

I am also getting error during test run locally

PHPUnit\Framework\Exception: PHP Deprecated: image_type_to_extension(): Passing null to parameter #1 ($image_type) of type int is deprecated in web/core/modules/system/src/Plugin/ImageToolkit/Operation/gd/Resize.php on line 63
🇮🇳India nitesh624 Ranchi, India

So should we Avoid this warning from drupal core side like https://www.drupal.org/project/drupal/issues/3261924 🐛 Avoid warning from imagecreatefrompng when loading png with obscure iCCP profiles Needs work .
And I see fixes in https://www.drupal.org/project/drupal/issues/3261924 🐛 Avoid warning from imagecreatefrompng when loading png with obscure iCCP profiles Needs work fixes this warning also. I am wondering if we can just update the test with scenario from this issue also

🇮🇳India nitesh624 Ranchi, India

Is this warning generated through issue in image file?

🇮🇳India nitesh624 Ranchi, India

But what was the exact scenario which https://www.drupal.org/project/easy_breadcrumb/issues/3421745 🐛 Home page segment not rendered as a link Fixed fixes?

🇮🇳India nitesh624 Ranchi, India

and I still don't get your Problem... If you are On the Homepage.. and there is a breadcrumb.. what is the point of putting out a link to the page I am on... since you got a custom Url... that you want to link to...

Yes for the first breadcrumb item I want to print a custom external url of another site.

🇮🇳India nitesh624 Ranchi, India

but is this a kind of workaround solution?

🇮🇳India nitesh624 Ranchi, India

@spuky thanks for snippet in #9. Thats worked for me. It will falls under no url case

🇮🇳India nitesh624 Ranchi, India

I tried {{ custom_url|raw }} but that is also not working. Seems it would be great of you can make the changes make in https://www.drupal.org/project/easy_breadcrumb/issues/3421745 🐛 Home page segment not rendered as a link Fixed to include as part of config. As some sites might need to rendered home page as link in first breadcrumb

🇮🇳India nitesh624 Ranchi, India

Here is my overriden twig

{% if breadcrumb %}
  <nav class="breadcrumb" role="navigation" aria-labelledby="system-breadcrumb">
    <h2 id="system-breadcrumb" class="visually-hidden">{{ 'Breadcrumb'|t }}</h2>
    <ol>
    {% for item in breadcrumb %}
      <li>
        {% if item.url %}
          {# Check the First Breadcrumb and custom #}
          {% if loop.first %}
            <a href="{{ custom_url }}">{{ item.text }}</a>
          {% else %}
            <a href="{{ item.url }}">{{ item.text }}</a>
          {% endif %}
        {% else %}
          {{ item.text }}
        {% endif %}
      </li>
    {% endfor %}
    </ol>
  </nav>
{% endif %}
🇮🇳India nitesh624 Ranchi, India

I am also getting this warning.

🇮🇳India nitesh624 Ranchi, India

the patch from #7 is working fine for me with drupal 10.3.5. this is major issue for editor after 10.3 upgrade. This need to be fixed asap. But as per comment in #19 "Of course I'm not sure if the proposed resolution is acceptable at all, as it doesn't really fix the root cause." which gives us bit hesitation in apply the patch from #7 for our project and uninstalling settings_tray also might impact the existing editing experience for editors.

🇮🇳India nitesh624 Ranchi, India

for me its happening when I upgrade my site drupal core version from 10.2.8 to 10.3.4.
Is there something change in 10.3 version which causing this schema error

🇮🇳India nitesh624 Ranchi, India

yes agreed with #10. this patch should be optional

🇮🇳India nitesh624 Ranchi, India

Yes with access policy approach we were able to get that working after adding cacheability .

But I am asking about the config override approach (below code)

class PermissionOverrides implements ConfigFactoryOverrideInterface {

/**
  * {@inheritdoc}
  */
public function loadOverrides($names) {
  $overrides = [];
  $role = 'user.role.test_role';
  if (in_array($role, $names)) {
    $types = $this->entityTypeManager()->getStorage('node_type')->loadMultiple();
    foreach ($types as $type) {
      $permission = 'Test permission ' . $type->id();
      $overrides[$role]['permissions'][$permission] = $permission;
    }
  }

  return $overrides;
}

/**
 * @return string
 */
public function getCacheSuffix() {
  return static::class;
}

/**
 * @param string $name
 *
 * @return \Drupal\Core\Cache\CacheableMetadata
 */
public function getCacheableMetadata($name) {
  return new CacheableMetadata();
}

/**
 * @param mixed $name
 * @param string $collection
 *
 * @return \Drupal\Core\Config\StorableConfigBase|null
 */
public function createConfigObject($name, $collection = StorageInterface::DEFAULT_COLLECTION) {
  return NULL;
}

}

Code snippets for Content type creation in Functional Test.

$this->drupalCreateContentType(['type' => 'test_content', 'name' => 'test_content']);

The above code is not working after inclusion of permission policy api. Means the test_content content type which we are creating in Functional test is not coming in the $types = $this->entityTypeManager()->getStorage('node_type')->loadMultiple();

When I debug more on this I found that on web/core/lib/Drupal/Core/Session/PermissionChecker.php file under hasPermission(), When I reverted back the changes committed in https://git.drupalcode.org/project/drupal/-/commit/9bb46296cee3aa33a9750... commit, Then my config override method is working fine

🇮🇳India nitesh624 Ranchi, India

But in my case newly created node
Type in functional test is not coming in config override service, Unless we forcefully clear the cache in functional test.

So somthing cache related in permission policy api causing this behaviour in our drupal site

🇮🇳India nitesh624 Ranchi, India

I agreed with https://www.drupal.org/project/drupal/issues/3463722#comment-15717005 🐛 ConfigFactoryOverrideInterface::loadOverrides not invoked after content type creation in Drupal 10.3.0+ Active . But will the caching changes affect the outcome of
$types = \Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple(); in above code snippet, when we are creating node in a Functional test like $this->drupalCreateContentType(['type' => 'test_content', 'name' => 'test_content']); ?

🇮🇳India nitesh624 Ranchi, India

Hoping This should be committed soon as there is security issue mentioned in https://www.drupal.org/project/views_data_export/issues/3388703#comment-... 🐛 Deprecated call to setCellValueByColumnAndRow RTBC

🇮🇳India nitesh624 Ranchi, India

Yes this is much needed and it will be great if this module get a security release asap. Thanks

🇮🇳India nitesh624 Ranchi, India

Are we expecting a new release for this issue as this blocks us to upgrade ctools to 4.x version?

🇮🇳India nitesh624 Ranchi, India

Here is my code snippet
-> custom_access/src/Access/AccessUnpublishedPermission.php

<?php

namespace Drupal\custom_access\Access;

use Drupal\Core\Session\AccessPolicyBase;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Session\CalculatedPermissionsItem;
use Drupal\Core\Session\RefinableCalculatedPermissionsInterface;

/**
 * Using the access policy API to allow  users to view unpublished content.
 */
class AccessUnpublishedPermission extends AccessPolicyBase {

  /**
   * {@inheritdoc}
   */
  public function calculatePermissions(AccountInterface $account, string $scope): RefinableCalculatedPermissionsInterface {
    $calculated_permissions = parent::calculatePermissions($account, $scope);
    $types = \Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple();
    $permission = [];
    foreach ($types as $type) {
      $permission[] = 'access_unpublished node ' . $type->id();
    }

    // If we aren't an anonymous user, return early.
    if (!in_array('anonymous', $account->getRoles())) {
      return $calculated_permissions;
    }

    return $calculated_permissions->addItem(new CalculatedPermissionsItem($permission));
  }

  public function getPersistentCacheContexts(): array {
    return ['user.roles:anonymous'];
  }

}

-> custom_access.services.yml

services:
  custom_access.access_policy.access_unpublished_permission:
    class: Drupal\custom_access\Access\AccessUnpublishedPermission
    tags:
      - { name: access_policy }

Then in Functional Test I am creating a test content type like below
$this->drupalCreateContentType(['type' => 'test_content', 'name' => 'test_content']);

The problem is after creating the content type like this in test, \Drupal::entityTypeManager()->getStorage('node_type')->loadMultiple();
service in AccessUnpublishedPermission.php file does not include the test_content content type

🇮🇳India nitesh624 Ranchi, India

I have update my custom code to assign permission through access policy but facing same issue

🇮🇳India nitesh624 Ranchi, India

This changes caused out Functional test to failed
More details on https://www.drupal.org/project/drupal/issues/3463722 🐛 ConfigFactoryOverrideInterface::loadOverrides not invoked after content type creation in Drupal 10.3.0+ Active

🇮🇳India nitesh624 Ranchi, India

for me also patch from #99 broken after 3.6 upgrade

🇮🇳India nitesh624 Ranchi, India

I ran the bisect between tags 10.2.7 and 10.3.1 by running below command
git bisect start
git bisect good tags/10.2.7
git bisect bad tags/10.3.1

then the commit which I get is setting the drupal core to 11.0-dev which leads to break testing.

🇮🇳India nitesh624 Ranchi, India

will git bisect show the code difference between these two versions?

🇮🇳India nitesh624 Ranchi, India

Hi are we fixing this issue in this module or are we waiting for https://www.drupal.org/project/drupal/issues/2940605 🐛 Can only intentionally re-render an entity with references 20 times Needs work to be fixed from core then?

🇮🇳India nitesh624 Ranchi, India

Patch #21 working fine for me with drupal 10.2.7

🇮🇳India nitesh624 Ranchi, India

Thanks for reply andy.
Yes for our use case it might be needed as we are creating some predefined block based to the base theme condition in hook_theme_installed() hook.

🇮🇳India nitesh624 Ranchi, India

We are also using this function in our custom module. But after deprecation there are no replacements suggested here.
So Is there any alternate workaround to achieve this?

🇮🇳India nitesh624 Ranchi, India

I see upstream issue is closed. So is that something missing from Drupal side or we need to see any workaround plugin

🇮🇳India nitesh624 Ranchi, India

Any update on this issue?
Will this be included in core?

🇮🇳India nitesh624 Ranchi, India

what is the proper method to get the reference entity object in node template. so that when there is no data in field reference then I will get null instead of node object.

🇮🇳India nitesh624 Ranchi, India

I guess the problem is in the template itself

1. I have added a taxonomy reference field (field_taxonomy_ref) in article content type.
2. Then in node--article.html.twig file I print {{ dump(node.field_taxonomy_ref.entity) }}, Which returns taxonomy entity object when there is data in this field but when this field is left empty then I am getting node object.

🇮🇳India nitesh624 Ranchi, India

thanks cilefen. Do you have link to documentation around this twig filter stuff?

🇮🇳India nitesh624 Ranchi, India

So i need to do this via hook_preprocess_template right?

🇮🇳India nitesh624 Ranchi, India

so will there be any issue, if any sites does not provide this permission-policy header?

🇮🇳India nitesh624 Ranchi, India

shouldn't this issue to be fixed from core instead of using contrib module?

🇮🇳India nitesh624 Ranchi, India

but our site does not have any track for used for advertisement.
By default chrome://settings/adPrivacy/interests settings is check and if I unchecked it the console error gone

🇮🇳India nitesh624 Ranchi, India

For me this failing during blt sync command. Which actually pull down the production database to local. and it runs couple of drush command
drush sql-sync-> this ran fine without any issue
drush cr -> Here the error came "The "paragraph" entity type did not specify a translation handler."

We have the multilingual enable on site and paragraph field also available on node, which allowed to be translated via content_translation module

🇮🇳India nitesh624 Ranchi, India

Is there any patch available for drupal 10.0.x release? We are also running into same problem

🇮🇳India nitesh624 Ranchi, India

I might be wrong but when I saw https://git.drupalcode.org/project/paragraphs/-/blob/8.x-1.x/src/Entity/... file I could not see translation class definition under handlers section

*   handlers = {
 *     "view_builder" = "Drupal\paragraphs\ParagraphViewBuilder",
 *     "access" = "Drupal\paragraphs\ParagraphAccessControlHandler",
 *     "storage_schema" = "Drupal\paragraphs\ParagraphStorageSchema",
 *     "form" = {
 *       "default" = "Drupal\Core\Entity\ContentEntityForm",
 *       "delete" = "Drupal\Core\Entity\ContentEntityDeleteForm",
 *       "edit" = "Drupal\Core\Entity\ContentEntityForm"
 *     },
 *     "views_data" = "Drupal\views\EntityViewsData",
 *   },

But when I went to core's node module src/Entity/Node.php I can see translation key see below snippet

 handlers = {
 *     "storage" = "Drupal\node\NodeStorage",
 *     "storage_schema" = "Drupal\node\NodeStorageSchema",
 *     "view_builder" = "Drupal\node\NodeViewBuilder",
 *     "access" = "Drupal\node\NodeAccessControlHandler",
 *     "views_data" = "Drupal\node\NodeViewsData",
 *     "form" = {
 *       "default" = "Drupal\node\NodeForm",
 *       "delete" = "Drupal\node\Form\NodeDeleteForm",
 *       "edit" = "Drupal\node\NodeForm",
 *       "delete-multiple-confirm" = "Drupal\node\Form\DeleteMultiple"
 *     },
 *     "route_provider" = {
 *       "html" = "Drupal\node\Entity\NodeRouteProvider",
 *     },
 *     "list_builder" = "Drupal\node\NodeListBuilder",
 *     "translation" = "Drupal\node\NodeTranslationHandler"
 *   },

I think paragraph should also have this translation handler.

🇮🇳India nitesh624 Ranchi, India

Now I am able to replicate this issue locally also with fresh vanilla drupal 10.1 installation.

🇮🇳India nitesh624 Ranchi, India

I am checking the http response code, if the request is ajax request and the route is of poll entity then I am checking if already poll exits for that Ip address then replacing the form with status message on page.

🇮🇳India nitesh624 Ranchi, India

I am able to show the warning message to user using response subscriber.

But still I am not able to understand why this is not happening on my local instance. Its happening only for hosted env. Is it because of IP restriction?

🇮🇳India nitesh624 Ranchi, India

Thank @berdir to pitching in.
Is there any way we can disable the cache on form. I tried setting max-age=0 on form build array. but still the problem persists.

One solution I see here is to catch and handle that error in a nicer way, possibly either through a request subscriber (detect the problem before it happens, return info that voting isn't allowed anymore for this IP), or a response subscriber (detect the exception, do the same).

For this approach where we can use request subscriber.? I am not able to understand approach.

🇮🇳India nitesh624 Ranchi, India

In the PollViewForm.php I have added
\Drupal::service('page_cache_kill_switch')->trigger(); on Line 86 under else section.
After that it seems to be working fine.

As I saw in function showPollResults() already we have \Drupal::service('page_cache_kill_switch')->trigger(); line at top.
So probably this issue could be due to this page_cache.

🇮🇳India nitesh624 Ranchi, India

Yes for me also patch doesn't seems to be solving the issue

🇮🇳India nitesh624 Ranchi, India

But if I add
$form['#cache]['max-age] = 0; in the src/Form/PollViewForm.php file line 114 before the return $form statement. The issue is no longer coming up.
So I assume something

🇮🇳India nitesh624 Ranchi, India

So I spent few days to get the steps to reproduce this issue

  • I spin up a D10 site in https://simplytest with poll module
  • I have allowed anonymous voting
  • I am connected to VPN on my system
  • Not I Visited the poll url on chrome browser, I was able to vote
  • Now I changed the network on my system and reconnected the vpn
  • Now I visited the poll page on Chrome browser I am getting vote results
  • Now I visited the poll page on Edge browser
  • Then I am getting poll form and on clicking the vote button i am getting ajax error
  • "Symfony\Component\HttpKernel\Exception\HttpException: The specified #ajax callback is empty or not callable. in Drupal\Core\Form\FormAjaxResponseBuilder->buildResponse() (line 67 of /var/lib/tugboat/stm/web/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php).
  • But When I cleared the drupal cache. the poll paeg shows the vote results
🇮🇳India nitesh624 Ranchi, India

Is it related to https://www.drupal.org/project/poll/issues/3263876 🐛 Sometimes not possible to vote 'The specified #ajax callback is empty or not callable' Needs work ?

🇮🇳India nitesh624 Ranchi, India

Tried the steps mentioned in #5 but not able to reproduce

🇮🇳India nitesh624 Ranchi, India

Hi @achap is there any patch or code snippet available which solves the issue?

🇮🇳India nitesh624 Ranchi, India

Above Merge Request solve the warning related to hook_requirements on status page

🇮🇳India nitesh624 Ranchi, India

@hkumar4 we need to do testing the simplesamlphp-2.1 branch of simplesamlphp library with 4.x branch of this module. then we can ask maintainer of simplesamlphp library to create release from that supported branch

🇮🇳India nitesh624 Ranchi, India

yes correct this will be drupal 10 only release

🇮🇳India nitesh624 Ranchi, India

I think simplesamlphp-2.1 is having only synfony 6 dependencies which mean we cant test this branch in D9

🇮🇳India nitesh624 Ranchi, India

I was trying to test this branch locally but due to composer dependecies of simplesaml_auth I could not able to install this branch

🇮🇳India nitesh624 Ranchi, India

We got comment on above issue

You can test-drive the simplesamlphp-2.1 release branch. If no issues show up in the next days I'm tagging a release

🇮🇳India nitesh624 Ranchi, India

Do we have fork of 1.x release?

🇮🇳India nitesh624 Ranchi, India

Yes I think 2.1 version will release in next few days. then we can expect some alpha release of this module.

🇮🇳India nitesh624 Ranchi, India

We got a comment from the maintainer of simplesamlphp on the https://github.com/simplesamlphp/simplesamlphp/issues/1825

You're already tagging the commit in your composer-file.. Why would you need a version-tag? It doesn't add anything.

It's really unfortunate (to say the least) that Drupal decided to skip the entire Symfony 5.4 LTS version... I get that it is an issue for you, but we follow Symfony LTS and do not have the capacity to keep up with the latest/newest stuff of everything in the ecosystem that relies on SimpleSAMLphp. Symfony 5.4 is supported until Nov '25, so we really have no incentive to rush things..

🇮🇳India nitesh624 Ranchi, India

Our use case is like below:
we have multisite setup
One site will work as SP for remote IDP like Azure Active Directory and this site will work as an IDP for rest of the sites.

For first part we can use saml_auth module. but for IDP we need to look for any other approach. Any suggestion for best approach for this Setup?

🇮🇳India nitesh624 Ranchi, India

I see a forked version also available https://packagist.org/packages/utexas/simplesamlphp_auth which is compatible with D10

🇮🇳India nitesh624 Ranchi, India

Can we use https://www.drupal.org/project/samlauth as replacement of this module. Is it providing similar functionality as the simplesamlphp_auth?

Production build 0.71.5 2024