Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Name Field
Scanned on Mon, 05/25/2020 - 11:50.
2 warnings found.
Check manually
Errors without Drupal source version numbers including parse errors and use of APIs from dependencies.
File name | Line | Error |
---|---|---|
web//Users/youri/Websites/drupal/git/d8/name/name.module | 89 | The module is defining "theme_name_item_list" theme function. Theme functions are deprecated. For more info, see https://www.drupal.org/node/2575445. |
web/modules/wip/name/name.info.yml | 0 | Add core_version_requirement: ^8 || ^9 to name.info.yml to designate that the module is compatible with Drupal 9. See https://drupal.org/node/3070687. |
Remaining tasks
- Convert theme functions to twig templates.
- Update functional tests, use Mink to look for fields or other page elements.
- Get all tests passing.
Comment | File | Size | Author |
---|---|---|---|
#21 | interdiff-3128409-20-21.txt | 26.33 KB | MegaChriz |
#21 | name-deprecations-3128409-21.patch | 64.19 KB | MegaChriz |
|
Comments
Comment #2
karishmaamin CreditAttribution: karishmaamin commentedplease review
Comment #4
nkoporecComment #5
ruchi-94 CreditAttribution: ruchi-94 as a volunteer and commentedComment #6
Farnoosh CreditAttribution: Farnoosh commented@karishmaamin: I cannot apply your patch. Did you create it against 8.x-1.x-dev?
drupal-check report against the dev version:
------ -------------------------------------------------------
Line src/NameFormatParser.php
------ -------------------------------------------------------
291 Call to deprecated method strtolower() of class
Drupal\Component\Utility\Unicode:
in drupal:8.6.0 and is removed from drupal:9.0.0. Use
mb_strtolower() instead.
295 Call to deprecated method strtoupper() of class
Drupal\Component\Utility\Unicode:
in drupal:8.6.0 and is removed from drupal:9.0.0. Use
mb_strtoupper() instead.
477 Call to deprecated method strlen() of class
Drupal\Component\Utility\Unicode:
in drupal:8.6.0 and is removed from drupal:9.0.0. Use
mb_strlen() instead.
483 Call to deprecated method substr() of class
Drupal\Component\Utility\Unicode:
in drupal:8.6.0 and is removed from drupal:9.0.0. Use
mb_substr() instead.
605 Call to deprecated method strtoupper() of class
Drupal\Component\Utility\Unicode:
in drupal:8.6.0 and is removed from drupal:9.0.0. Use
mb_strtoupper() instead.
611 Call to deprecated method strtoupper() of class
Drupal\Component\Utility\Unicode:
in drupal:8.6.0 and is removed from drupal:9.0.0. Use
mb_strtoupper() instead.
------ -------------------------------------------------------
------ -------------------------------------------------------------------
Comment #7
ruchi-94 CreditAttribution: ruchi-94 as a volunteer and commentedComment #8
ruchi-94 CreditAttribution: ruchi-94 as a volunteer and commentedComment #10
Farnoosh CreditAttribution: Farnoosh commentedThank you @ruchi-94. Patch #7 looks good.
There are few minor changes as per drupal-check report.
------ -----------------------------------------------------------------------
Line src/NameAutocomplete.php
------ -----------------------------------------------------------------------
120 Array and string offset access syntax with curly braces is deprecated
121 Array and string offset access syntax with curly braces is deprecated
------ -----------------------------------------------------------------------
------ ------------------------------------------------------------------------
Line src/Tests/NameAutocompleteTest.php
------ ------------------------------------------------------------------------
104 Call to deprecated function entity_create():
in drupal:8.0.0 and is removed from drupal:9.0.0. Use
The method overriding Entity::create() for the entity type, e.g.
\Drupal\node\Entity\Node::create() if the entity type is known. If the
entity type is variable, use the entity storage's create() method to
construct a new entity:
------ ------------------------------------------------------------------------
------ ---------------------------------------------------------------------------
Line src/Tests/NameUserTest.php
------ ---------------------------------------------------------------------------
114 Call to deprecated function user_format_name():
in drupal:8.0.0 and is removed from drupal:9.0.0.
Use $account->label() or $account->getDisplayName() instead
115 Call to deprecated method getUsername() of class Drupal\user\Entity\User:
in drupal:8.0.0 and is removed from drupal:9.0.0.
Use \Drupal\Core\Session\AccountInterface::getAccountName() or
\Drupal\user\UserInterface::getDisplayName() instead.
------ ---------------------------------------------------------------------------
Comment #11
Farnoosh CreditAttribution: Farnoosh commentedThis patch does not include any work from patch #7.
Comment #13
abhijeet.kumar2107 CreditAttribution: abhijeet.kumar2107 as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedComment #14
abhijeet.kumar2107 CreditAttribution: abhijeet.kumar2107 as a volunteer and at Srijan | A Material+ Company for Drupal India Association commentedComment #15
ruchi-94 CreditAttribution: ruchi-94 as a volunteer and commentedComment #16
ruchi-94 CreditAttribution: ruchi-94 as a volunteer and commentedchanges made as per suggestion in #10
Comment #17
MegaChriz CreditAttribution: MegaChriz at WebCoo commentedI found some issues in the patch from #16 and I've tried to fix them.
Summary of the changes:
messenger()
instead of using\Drupal::messenger()
. This is because FormBase uses the MessengerTrait.\Drupal::database()
). I copied this code from Drupal\views\Plugin\views\filter\StringFilter.There are some additional deprecations reported by the Upgrade Status module which I have not fixed:
Name Field
Check manually
core_version_requirement: ^8 || ^9
to name.info.yml to designate that the module is compatible with Drupal 9. See https://drupal.org/node/3070687.I put this in the issue summary.
I haven't tested the module manually after making the changes. Let's first see if the tests will pass.
Comment #18
Alan D. CreditAttribution: Alan D. commentedLet me know if anyone is keen to co-maintain, I'm time short atm.
Comment #19
MegaChriz CreditAttribution: MegaChriz at WebCoo commentedI looked at the test failures and started working on fixing them.
A good replacement for
$element->asXML()
could be $element->getHtml(). It happens that in WebTestBase a call to the methodxpath()
returned a\SimpleXMLElement
, but in BrowserTestBase a\Behat\Mink\Element\NodeElement
is returned. I did this at all locations, but locally the tests failed on an other thing after that.Convert code to use Mink
I see that xpath is used a lot for checking if certain fields or other elements exist in the HTML output. In Drupal browser tests that are based on PHPUnit, Mink is used to do these checks. I therefore think that all code that is using xpath should be converted to use Mink. I added several
@todo
's in the code.Also added
$defaultTheme
to NameTestBase.@Alan D.
I'm not sure I'll have the time to help maintaining this module. I was just looking into this to see if I already could update a relatively small site to Drupal 9.
Comment #20
MegaChriz CreditAttribution: MegaChriz at WebCoo commentedThis should fix NameAdminTest.
Contains also a single coding standards fix: properties $web_user and $admin_user have been renamed to $webUser and $adminUser.
Still needs work because of failing NameWidgetTest.
Comment #21
MegaChriz CreditAttribution: MegaChriz at WebCoo commentedThis should fix NameWidgetTest.
Additionally, I also fixed the following issues:
assertTrue()
calls with better alternatives, for example withassertInstanceOf()
.I realize this patch is becoming quite big - which makes it harder to review. If you want me to divide it into multiple chunks, I can do that.
I could do for example the following divisions:
The patch for converting the tests would remain big, I'm afraid.
Still left to do: convert theme functions to twig templates. That could be big patch by itself, so I would say that this should be postponed to a follow-up.
Comment #22
wrd CreditAttribution: wrd as a volunteer commentedPatch applies to 2.x-dev, and in conjunction with https://www.drupal.org/files/issues/2020-04-17/name-3128599-2.patch (which simply adds the core_version_requirement), I can successfully add and configure a name field on a content type.
Comment #23
Ruslan PiskarovLooks good to me.
Comment #24
joshua.boltz CreditAttribution: joshua.boltz at Mediacurrent commentedThis looks good in combination with the patch that adds the core_version_requirement to the module's info.yml file.
It would be great to get these committed, so that folks don't need to include the patches via composer, because, in my experience, and possibly others, even though a patch adds the `core_version_requirement` value, composer still complains that it's not D9 supported.
In my understanding, there is a process that happens on the packagist repo when composer pulls down a module, where based on the `core_version_requirement`, it sets the values for the module in the composer.lock file, such as
But, when adding patches, even though the info.yml is right, the .lock file still contains the old values
Which will be an issue during the D9 upgrade process.
Comment #26
Alan D. CreditAttribution: Alan D. commentedThanks everyone!
I didn't review but with no critical issues for the 8.x branch I've pushed these through directly.
As an aside, being out of the loop for a year or more, should I be creating a new branch for D9+ now? My lazy search didn't show much info and the project patch guide seems outdated.
Comment #27
nkoporecAlen D. no need for a new branch, you can just tag a new release candidate, eq: 8.x-1.0-rc3
Comment #28
nkoporecComment #29
nkoporecComment #30
Alan D. CreditAttribution: Alan D. commentedCool thanks, albeit I may branch to 1.x once D8 is depreciated :)
I'll leave dev as is for a while before tagging up a new release.
Comment #31
MegaChriz CreditAttribution: MegaChriz as a volunteer and at WebCoo commented@Alan D.
If you want to switch to semantic versioning, you would need to increase the major version. But for D9 support you don’t necessarily have to switch.
From https://www.drupal.org/node/1015226#semver-transition:
Comment #32
Alan D. CreditAttribution: Alan D. commentedThanks :)
Comment #34
mrshowermanI still get this warning after cache rebuild:
I guess this is due to the functions defined in name.theme.inc.
Comment #35
MegaChriz CreditAttribution: MegaChriz as a volunteer and at WebCoo commented@mrshowerman
Correct, we need to open a follow-up issue for that. I noted this in comment #21:
Do you want to create a new issue for that?
Note that theme functions will keep working during the D9 release cycle, so there is less urgency to change it right now. But the sooner it is done, the better, I guess.
Comment #36
MegaChriz CreditAttribution: MegaChriz as a volunteer and at WebCoo commentedAh, I see someone already opened a follow-up: #3168948: Remove theme functions deprecated in Drupal 9
Comment #37
mrshowermanThanks @MegaChriz for pointing this out. Added the follow-up as a related issue.
Comment #38
JasonLuttrellFor anyone else wondering, the theme-related error message can be silenced with a quick/temporary patch:
Hopefully, someone will fix this soon?