Automated Drupal 11 compatibility fixes for entity_language_fallback

Created on 17 March 2024, about 1 year ago

Problem/Motivation

Hello project maintainers,

This is an automated issue to help make this module compatible with Drupal 11.

Changes will periodically be added to this issue that remove deprecated API uses. To stop further changes from being posted, change the status to anything other than Active, Needs review, Needs work or Reviewed and tested by the community. Alternatively, you can remove the "ProjectUpdateBotD11" tag from the issue to stop the bot from posting updates.

The changes will be posted by the Project Update Bot → official user account. This account will not receive any issue credit contributions for itself or any company.

Proposed resolution

You have a few options for how to use this issue:

  1. Accept automated changes until this issue is closed

    If this issue is left open (status of Active, Needs review, Needs work or Reviewed and tested by the community) and the "ProjectUpdateBotD11" tag is left on this issue, new changes will be posted periodically if new deprecation fixes are needed.

    As the Drupal Rector project improves and is able to fix more deprecated API uses, the changes posted here will cover more of the deprecated API uses in the module.

    Patches and/or merge requests posted by others are ignored by the bot, and general human interactions in the issue do not stop the bot from posting updates, so feel free to use this issue to refine bot changes. The bot will still post new changes then if there is a change in the new generated patch compared to the changes that the bot posted last. Those changes are then up to humans to integrate.

  2. Leave open but stop new automated changes.

    If you want to use this issue as a starting point to remove deprecated API uses but then don't want new automated changes, remove the "ProjectUpdateBotD11" tag from the issue and use it like any other issue (the status does not matter then). If you want to receive automated changes again, add back the "ProjectUpdateBotD11" tag.

  3. Close it and don't use it

    If the maintainers of this project don't find this issue useful, they can close this issue (any status besides Active, Needs review, Needs work and Reviewed and tested by the community) and no more automated changes will be posted here.

    If the issue is reopened, then new automated changes will be posted.

    If you are using another issue(s) to work on Drupal 11 compatibility it would be very useful to other contributors to add those issues as "Related issues" when closing this issue.

Remaining tasks

Using the patches

  1. Apply the latest patch in the comments by Project Update Bot → or human contributors that made it better.
  2. Thoroughly test the patch. These patches are automatically generated so they haven't been tested manually or automatically.
  3. Provide feedback about how the testing went. If you can improve the patch, post an updated patch here.

Using the merge request

  1. Review the merge request and test it.
  2. Thoroughly test the changes. These changes are automatically generated so they haven't been tested manually or automatically.
  3. Provide feedback about how the testing went. If you can improve the merge request, create a new branch and merge request and work from there.

Warning: The 'project-update-bot-only' branch will always be overwritten. Do not work in that branch!

Providing feedback

If there are problems with one of the changes posted by the Project Update Bot → , such as it does not correctly replace a deprecation, you can file an issue in the Drupal Rector issue queue → . For other issues with the bot, for instance if the issue summary created by the bot is unclear, use the Project analysis issue queue → .

📌 Task
Status

Needs review

Version

1.5

Component

Code

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @project update bot
  • This is an automated patch generated using Upgrade Status and Drupal Rector. Please see the issue summary for more details. A merge request is also openend and updated.

    It is important that any automated tests available are run and that you manually test the changes.

    Drupal 11 Compatibility

    According to the Upgrade Status module → these changes make this module compatible with Drupal 11! 🎉
    Therefore these changes update the info.yml file for Drupal 11 compatibility.

    Leaving this issue open, even after committing the current patch, will allow the Project Update Bot → to post additional Drupal 11 compatibility fixes as they become available in Drupal Rector.

    Debug info

    Bot run #11-121090

    This patch was created using these packages:

    1. drupal/upgrade_status: 4.1.0
    2. mglaman/phpstan-drupal: 1.2.7
    3. palantirnet/drupal-rector: 0.20.1
  • 🇨🇦Canada alberto56

    Hi all, is there a plan to release a Drupal 11 version of this module? If not, would the maintainers be open to having a co-maintaner?

  • 🇺🇦Ukraine Anna D

    +1 for a Drupal 11 release of this module. Thank you!

  • 🇮🇳India flutterstack

    php vendor/bin/drupal-check -d web/modules/custom/entity_language_fallback/
    Deprecated: The drupal_root parameter is deprecated. Remove it from your configuration. Drupal Root is discovered automatically. in /var/www/html/vendor/mglaman/phpstan-drupal/src/Drupal/DrupalAutoloader.php on line 94
    7/7 [â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“â–“] 100%

    ------ --------------------------------------------------------------------------
    Line entity_language_fallback.module
    ------ --------------------------------------------------------------------------
    37 Call to an undefined method
    Drupal\Core\Form\FormInterface::getEntity().
    105 Access to an undefined property
    Drupal\Core\Entity\ContentEntityInterface::$search_api_skip_tracking.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    142 Access to an undefined property
    Drupal\Core\Entity\ContentEntityInterface::$search_api_skip_tracking.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    152 Variable $fallback_controller in isset() always exists and is not
    nullable.
    162 Access to an undefined property
    Drupal\Core\Entity\ContentEntityInterface::$original.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    220 Access to an undefined property
    Drupal\Core\Entity\ContentEntityInterface::$search_api_skip_tracking.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    243 Parameter $index of function
    entity_language_fallback_search_api_index_items_alter() has invalid
    type Drupal\search_api\IndexInterface.
    245 PHPDoc tag @var for variable $item contains unknown class
    Drupal\search_api\Item\Item.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    246 Call to method getOriginalObject() on an unknown class
    Drupal\search_api\Item\Item.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    249 Call to method setLanguage() on an unknown class
    Drupal\search_api\Item\Item.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    ------ --------------------------------------------------------------------------

    ------ --------------------------------------------------------------------------
    Line src/AccessHelper.php
    ------ --------------------------------------------------------------------------
    49 Access to an undefined property
    Drupal\Core\Entity\ContentEntityInterface::$search_api_skip_tracking.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    64 Access to an undefined property
    Drupal\Core\Entity\ContentEntityInterface::$preventLooping.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    ------ --------------------------------------------------------------------------

    ------ --------------------------------------------------------------------------
    Line src/FallbackController.php
    ------ --------------------------------------------------------------------------
    49 Access to an undefined property
    Drupal\entity_language_fallback\FallbackController::$entityTypeManager.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    ------ --------------------------------------------------------------------------

    ------ -------------------------------------------------------------------------------------------------------------
    Line src/Plugin/search_api/datasource/ContentEntityFallback.php
    ------ -------------------------------------------------------------------------------------------------------------
    28 Class
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback
    extends unknown class
    Drupal\search_api\Plugin\search_api\datasource\ContentEntity.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    42 Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::create()
    calls parent::create() but
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback
    does not extend any class.
    70 Call to an undefined method
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::getEntityStorage().
    72 Call to an undefined method
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::getBundles().
    77 Access to an undefined property
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::$languages.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    84 Access to an undefined property
    Drupal\Core\TypedData\ComplexDataInterface::$language.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    93 Access to an undefined property
    Drupal\Core\TypedData\ComplexDataInterface::$language.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    94 Access to an undefined property
    Drupal\Core\TypedData\ComplexDataInterface::$fallbackLanguage.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    106 Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::getPartialItemIds()
    calls parent::getPartialItemIds() but
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback
    does not extend any class.
    113 Call to static method splitPropertyPath() on an unknown class
    Drupal\search_api\Utility\Utility.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    118 Call to an undefined method
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::getEntityStorage().
    119 Access to an undefined property
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::$languages.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    125 Access to an undefined property
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::$fallback_chain.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    138 Variable $item_ids might not be defined.
    145 Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::getLanguages()
    calls parent::getLanguages() but
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback
    does not extend any class.
    147 Access to an undefined property
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::$languages.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    149 Access to an undefined property
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::$fallback_chain.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    163 Call to static method loadMultiple() on an unknown class
    Drupal\search_api\Entity\Index.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    217 Parameter $index of method
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::filterValidItemIds()
    has invalid type Drupal\search_api\IndexInterface.
    217 Parameter $index of method
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::filterValidItemIds()
    has invalid type Drupal\search_api\IndexInterface.
    218 Class
    Drupal\search_api\Plugin\search_api\datasource\ContentEntityTrackingManager
    not found.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    222 Call to static method filterValidItemIds() on an unknown class
    Drupal\search_api\Plugin\search_api\datasource\ContentEntity.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    231 Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::getItemAccessResult()
    calls parent::getItemAccessResult() but
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback
    does not extend any class.
    233 Call to an undefined method
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::getEntity().
    235 Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::getItemAccessResult()
    calls parent::getItemAccessResult() but
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback
    does not extend any class.
    238 Call to an undefined method
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::getEntityTypeManager().
    239 Call to an undefined method
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback::getEntityTypeId().
    ------ -------------------------------------------------------------------------------------------------------------

    ------ -----------------------------------------------------------------------------------------------------------------------
    Line src/Plugin/search_api/datasource/ContentEntityFallbackDeriver.php
    ------ -----------------------------------------------------------------------------------------------------------------------
    10 Class
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallbackDeriver
    extends unknown class
    Drupal\search_api\Plugin\search_api\datasource\ContentEntityDeriver.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    17 Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallbackDeriver::getDerivativeDefinitions()
    calls parent::getDerivativeDefinitions() but
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallbackDeriver
    does not extend any class.
    19 Call to an undefined method
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallbackDeriver::t().
    21 Access to an undefined property
    Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallbackDeriver::$derivatives.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    ------ -----------------------------------------------------------------------------------------------------------------------

    ------ ----------------------------------------------------------------------------------------
    Line src/Plugin/search_api/processor/FallbackLanguage.php
    ------ ----------------------------------------------------------------------------------------
    25 Class
    Drupal\entity_language_fallback\Plugin\search_api\processor\FallbackLanguage
    extends unknown class
    Drupal\search_api\Processor\ProcessorPluginBase.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    41 PHPDoc tag @var for variable $item contains unknown class
    Drupal\search_api\Item\ItemInterface.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    42 Call to method getOriginalObject() on an unknown class
    Drupal\search_api\Item\ItemInterface.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    52 Access to an undefined property
    Drupal\Core\Entity\ContentEntityInterface::$content_translation_source.
    💡 Learn more:
    https://phpstan.org/blog/solving-phpstan-access-to-undefined-property
    70 Variable $candidate might not be defined.
    71 Variable $candidate might not be defined.
    72 Call to method getDatasource() on an unknown class
    Drupal\search_api\Item\ItemInterface.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    72 Call to method getIndex() on an unknown class
    Drupal\search_api\Item\ItemInterface.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    72 Instantiated class Drupal\search_api\Item\Item not found.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    74 Call to method setOriginalObject() on an unknown class
    Drupal\search_api\Item\Item.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    75 Call to method setLanguage() on an unknown class
    Drupal\search_api\Item\Item.
    💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
    96 Drupal\entity_language_fallback\Plugin\search_api\processor\FallbackLanguage::create()
    calls parent::create() but
    Drupal\entity_language_fallback\Plugin\search_api\processor\FallbackLanguage
    does not extend any class.
    ------ ----------------------------------------------------------------------------------------

    [ERROR] Found 56 errors

    Thanks for using drupal-check!

    Consider sponsoring the development of the maintainers which make drupal-check possible:

    - phpstan (ondrejmirtes): https://github.com/sponsors/ondrejmirtes
    - phpstan-deprecation-rules (ondrejmirtes)): https://github.com/sponsors/ondrejmirtes
    - phpstan-drupal (mglaman)): https://github.com/sponsors/mglaman
    - drupal-check (mglaman)): https://github.com/sponsors/mglaman

  • 🇮🇳India flutterstack

    1.
    ------ ---------------------------------------------------------------------------------------------------------------------------------------------
    Line entity_language_fallback.module
    ------ ---------------------------------------------------------------------------------------------------------------------------------------------
    124 Call to deprecated method filterValidItemIds() of class Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback:
    in search_api:8.x-1.22 and is removed from search_api:2.0.0.
    Use
    \Drupal\search_api\Plugin\search_api\datasource\ContentEntityTrackingManager::filterValidItemIds()
    instead.
    184 Call to deprecated method filterValidItemIds() of class Drupal\entity_language_fallback\Plugin\search_api\datasource\ContentEntityFallback:
    in search_api:8.x-1.22 and is removed from search_api:2.0.0.
    Use
    \Drupal\search_api\Plugin\search_api\datasource\ContentEntityTrackingManager::filterValidItemIds()
    instead.

    regarding above deprecated issues are already taken care by creating wrapper in filterValidItemIds method:
    In entity_language_fallback/src/Plugin/search_api/datasource/ContentEntityFallback.php file in 8.1.x. we will ignore this error.

    2.

    $languages and $fallback_chain properties added in src/Plugin/search_api/datasource/ContentEntityFallback.php in #7 patch.

    You can verify entity-language-fallback-drupal-11-compatibility-fixes-3430185-7.patch by

    downloading https://git.drupalcode.org/project/entity_language_fallback.git into your drupal 11 instance and apply the #7 patch.

    * enable the entity_language_fallback module

    * Create multiple languages in /admin/config/regional/language.
    for example :- default language English , add French and Spanish as a new languages to the site.

    * Edit each language and select fallback languages .
    for example :- Edit Spanish and select French as language fallback in priority 1, select English as language fallback in priority 2

    * Now create a content and add translation for few languages .
    for example :- If you created the node/1 in default language English , add translation for French.

    * Now try to access the content in spanish /es/node/1 it should show french version content.

Production build 0.71.5 2024