Using D9.0.3

php error when installing footnotes:

User deprecated function: Theme functions are deprecated in drupal:8.0.0 and are removed from drupal:10.0.0. Use Twig templates instead of theme_footnote_link(). See https://www.drupal.org/node/1831138 in Drupal\Core\Theme\Registry->processExtension() (line 498 of core/lib/Drupal/Core/Theme/Registry.php).
Drupal\Core\Theme\Registry->processExtension(Array, 'footnotes', 'module', 'footnotes', 'modules/contrib/footnotes') (Line: 341)
Drupal\Core\Theme\Registry->build() (Line: 240)
Drupal\Core\Theme\Registry->get() (Line: 88)

Issue fork footnotes-3169299

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Yuri created an issue. See original summary.

Yuri’s picture

Issue summary: View changes
Yuri’s picture

Priority: Normal » Major

setting to Major because this error prevents database updates

phjou’s picture

I confirm this bug, lots of warnings in the logs everytime you load a ckeditor.

phjou’s picture

Ok I think I did the minimal patch needed to fix this. The generation of the HTML that is spit for the list seems pretty old school php but I didn't want to touch that part to avoid regressions. It probably should be done in a different issue after this one.

Let me know if this patch works for you. It seems ok for me on Drupal 9.

AnticoVeneziano’s picture

StatusFileSize
new78.69 KB

hi,
thanks! but
the patch cleaned the warnings, but sadly now all the html tags appears in the footnotes...

AnticoVeneziano’s picture

StatusFileSize
new66.2 KB

hi,
on localhost everything works fine with the same website, and also with a simple installation of drupal 9...
online warnings (without patch) or tags exposed (with patch)...

xmacinfo’s picture

Status: Active » Needs review
cestmoi’s picture

same as in comment #6 but it's happening on localhost and haven't tested online. The patch makes the module useless this way unfortunately. on Latest drupal 9.1.2

xmacinfo’s picture

Status: Needs review » Needs work
baluertl’s picture

Title: User deprecated function: Theme functions » Use of deprecated theme functions
baluertl’s picture

Also important to check whether CKEditor loads properly on /node/add/page and /node/{NID}/edit pages? For me enabling the patched Footnotes module breaks WYSIWYG functionality by some strange reasons.

szds’s picture

StatusFileSize
new6.76 KB

Here is a patch for the version 8.x-2.1 which is tested to work for D9.1.3 .

xmacinfo’s picture

+++ b/footnotes.module
@@ -30,85 +30,21 @@ function footnotes_help($route_name, RouteMatchInterface $route_match) {
 }

Looks like tabs instead of spaces.

szds’s picture

StatusFileSize
new6.28 KB

Similar to patch in #13 with array() changed to [] and tabs replaced with spaces. Tested for D9.1.3 for add/edit nodes and CKEditor.

xmacinfo’s picture

Status: Needs work » Needs review
cestmoi’s picture

The patch in #15 got rid of the warning and everything looks fine except for when the footnote has any html it's then exposed in the footnote text display. Otherwise, the list and numbering seems fine.

Tested locally for D9.1.4 for add/edit node and CKEditor

szds’s picture

StatusFileSize
new6.29 KB

HTML in the footnotes is an interesting use case. In the source you have to add html within the <fn></fn> tags. For the CKEditor the Source button has to be available.

You can render HTML by using the raw filter in the twig file. In general, this is not the best approach. At least for the CKEditor, XSS can be avoided by ensuring that the Text format filters out some tags (e.g. script tag).

Here is a patch that allows the rendering of HTML in the footnotes. It differs from the patch in #15 only by adding the raw filter to the footnote-list.html.twig file.

cestmoi’s picture

The last patch in #18 is working great now. Tested with html in footnote text and all looks great now. Thanks @szds

On latest Drupal 9.1.4 and Footnotes 2.x-dev

xmacinfo’s picture

Let's see if tests are passing on D9.1.

cestmoi’s picture

StatusFileSize
new5.96 KB

The patch test is failing I think due to the version patch in .info which is not needed as this module dev version is already converted to D9.
I just removed the patch part for the .info file and let's re-test it

xmacinfo’s picture

Status: Needs review » Needs work
szds’s picture

StatusFileSize
new6.32 KB

Here is the patch for the dev version 8.x-2.x-dev

This also fixes the issue (3195978) wherein the footnotes list currently can only be placed at the default location at the end of the node; adding a placeholder [footnotes] or [footnotes /] or <footnotes> , within the content adds the footnotes list but removes the text subsequent to the location of the placeholder.

xmacinfo’s picture

Status: Needs work » Needs review
scott_euser’s picture

Just a quick fix to coding standards indentation, but otherwise this works well for me in Drupal 9, gets rid of deprecation notices + nicely allows better theme control over the output, so win win, thanks! RTBC from me (but since the coding standards change, will leave at NR).

kleiton_rodrigues’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new25.09 KB
new131.35 KB

Tested your patch looks good to me...
thanks!
RTBC +1

  • pifagor committed d021811 on 8.x-2.x authored by scott_euser
    Issue #3169299 by szds, Balu Ertl, scott_euser, cestmoi, phjou,...
pifagor’s picture

Status: Reviewed & tested by the community » Fixed

Thanks,fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.