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.
I wanted to get the ball rolling on the D8 port. I would like to request the patch be reviewed and a 8.x branch to be created. The patch is attached in the comment below.
- Converted info file to yml
- Converted variables to CMI
- Replaced deprecated functions accordingly
Comment | File | Size | Author |
---|---|---|---|
#18 | prettify-d8-port-2015671-17.patch | 49.64 KB | eporama |
#18 | interdiff.txt | 522 bytes | eporama |
#16 | prettify-d8-port-2015671-16.patch | 48.91 KB | eporama |
#14 | interdiff-2015671-12-14.txt | 4.67 KB | eporama |
#14 | prettify-drupal8-2015671-14.patch | 47.88 KB | eporama |
Comments
Comment #1
desmondmorris CreditAttribution: desmondmorris commentedComment #2
smartinm CreditAttribution: smartinm commentedHi Desmond, thanks for your efforts to port this module to D8.
Please give me some time to review the patch ;-)
Comment #3
desmondmorris CreditAttribution: desmondmorris commentedNo problem!
Comment #4
smartinm CreditAttribution: smartinm commentedI've been testing the patch on my dev site. Patch is fine but the module still don't work on D8 because prettify css/js is added on
hook_init()
and as of Drupal 8,hook_init()
no longer exists (https://drupal.org/node/2013014).I've re-rolled the path and made a couple small changes.
Comment #5
desmondmorris CreditAttribution: desmondmorris commentedGood catch. I think hook_init was still alive and kicking in the version I patched against.
Comment #6
chertzogchasing head, and restructuring accordingly.
Comment #7
chertzogComment #8
chertzogHere is a better patch that adds the missing files.
Comment #9
lolandese CreditAttribution: lolandese commented@ #8:
On a drupal 8.0-alpha3 it breaks the site (Server error,
[error] [client 127.0.0.1] PHP Fatal error: Undefined class constant 'VERSION' in /home/martin/www/black/modules/prettify/prettify.module on line 84, referer: http://black.dev/admin/modules
), even after adding (prettify.module line 85):It was mentioned in the article to use a certain HEAD checkout and indeed on the latest git grabbed version it went well.
As a minor can be mentioned the following Drupal error message:
Warning: Invalid argument supplied for foreach() in prettify_add_library() (line 304 of modules/prettify/prettify.module).
It disappeared after a while.
Furthermore I had the following in my error log:
[error] [client 127.0.0.1] (13)Permission denied: file permissions deny server access: /home/martin/www/beige/libraries/prettify/prettify.js, referer: http://beige.dev/admin/config/user-interface/prettify?render=overlay
I changed the file permissions manually.
The module works as expected. I think that after adding the dependencies in hook_library_info() and rerolling the patch this is ready for RTBC.
Thanks.
Comment #10
smartinm CreditAttribution: smartinm commentedThanks for all the work done here. I'll create new a new branch for D8 and commit when it's RTBC.
Comment #11
Finn Lewis CreditAttribution: Finn Lewis commentedGreat work! This certainly got the ball rolling for me.
I read the fantastic blog post from cherzthog at http://chertzog.com/post/up-and-running-on-drupal-8 which lead me here.
The recent changes renaming drupal_add_js and drupal_add_css meant I had to make some more changes to get it working with the latest Drupal 8 HEAD.
I now have it working locally, which is nice.
Please see attached a patch against the latest 7.x-1.x-dev (2013-Oct-01)
This patch includes all the other changes from patch from comment #8.
Hope this helps someone.
Looking forward to an 8.x branch to work against.
Comment #12
Finn Lewis CreditAttribution: Finn Lewis commentedWoops! I didn't create that last patch properly.
Please see revised patch, which I just tested against 7.x-1.x-dev (2013-Oct-01)
This time it works!
However,
Comment #13
Finn Lewis CreditAttribution: Finn Lewis commentedComment #14
eporama CreditAttribution: eporama commentedI have gotten a patch that applies and gets part of the way there. But it does allow the module to not throw errors on installation or general configuration.
There do seem to be some issues once it's there.
Hopefully soon we could open a 8.x branch so that commits and bugs could be filed a bit more selectively.
Comment #15
krisp1 CreditAttribution: krisp1 commentedWhen I apply the patch above #14 with git am --signoff it is telling me the patch does not have a valid e-mail address. The patch is also adding a lot of whitespace and does not allow me to enable the module once applied.
Comment #16
eporama CreditAttribution: eporama commentedHere's a new patch that applies to 7.x-1.x from format-patch that does not have any of the whitespace errors and applies cleanly
Since the previous patch didn't apply, I didn't create an interdiff. Leaving the status at needs review.
~ $ git clone --branch 7.x-1.x http://git.drupal.org/project/prettify.git
Cloning into 'prettify'...
remote: Counting objects: 122, done.
remote: Compressing objects: 100% (120/120), done.
remote: Total 122 (delta 63), reused 0 (delta 0)
Receiving objects: 100% (122/122), 37.93 KiB, done.
Resolving deltas: 100% (63/63), done.
~ $ cd prettify/
prettify (7.x-1.x) $ git checkout -b 8.x-1.x
Switched to a new branch '8.x-1.x'
prettify (8.x-1.x) $ git apply ~/Desktop/prettify-d8-port-2015671-16.patch
prettify (8.x-1.x) $
Comment #17
eporama CreditAttribution: eporama commentedquick fix to the problem 1 in comment #14
Simple fix. The
drupal_render()
of the prettified code is being appended to$text
, not replacing it.With this, I am able to enable the module, download the prettify js to sites/all/libraries, add it as a filter on "restricted HTML", and add code to a page with that format. So it's "working"
Comment #18
eporama CreditAttribution: eporama commentedHmm... "Back" in the browser removed my uploaded files. Whoops.
Comment #19
maciej.zgadzaj CreditAttribution: maciej.zgadzaj commentedQuick update on this: First of all, "patched" version does not work with current D8 at all anymore. However, starting with patch from #18, I have done a basic port that seems to work with v8.3 - it's available at https://github.com/maciejzgadzaj/prettify if anyone's interested (and would like to take it any further) - I am not going to be working on it anymore, as I have switched to CodeSnippet.