With the release of Drupal 8.0.0-rc1 it has become clear that the 8.x-1.x-dev version of the Site Status Module is not compatible.

This issue has been created to make others aware and I will create a working version hopefully before the first proper version of Drupal 8.

Comments

SkidNCrashwell created an issue. See original summary.

drupalgideon’s picture

Title: Does not work with Drupal 8.0.0-rc1 released » Does not work with Drupal 8.0.0-rc1 release.
drupalgideon’s picture

Issue summary: View changes
shkiper’s picture

Status: Active » Needs review
StatusFileSize
new7.98 KB

I made this module compatible with Drupal 8. Could someone check my patch?

drupalgideon’s picture

Thanks for this. I really appreciate the work you've put in.

I did get a "The website encountered an unexpected error. Please try again later." message unfortunately when I put as the Read More page. And paths require the "/" too or this error occurs as well.

Also I was planning on incorporating the changes in the 7.x-dev branch which moves the configuration to a new page. I'm assuming that the Variables for multilingual support are handled in Drupal 8 Core.

shkiper’s picture

Hi @SkidNCrashwell. What data did you tried to put in the link settings? As I understood Drupal 8 accepts internal links only if they start from '/'. I guess I need to add validation for this.

drupalgideon’s picture

Yes I tried <front> and "node/1" rather than "/node/1" (I was testing to break!)

I reckon something like

$link = ($link[0] == '/') ? $link : '/' . $link;

in the validator should help.

shkiper’s picture

Hi @SkidNCrashwell. I've added additional validation for link. Could you please check my new patch?

drupalgideon’s picture

Great stuff! Thank you.

However, I had a few issues on my brief testing.

I entered /node/1 for the URL and got an error saying

Manually entered paths should start with /, ? or #.

I changed one line to only look at the first character of the raw link for the in_array check as follows -

if (parse_url($link, PHP_URL_SCHEME) === 'internal' && !in_array($raw_link[0], ['/', '?', '#'], TRUE) && substr($raw_link, 0, 7) !== '<front>') {

This passed the first test but then I got an invalid internal path error.

I then made another change to check the raw link which worked.

    if (substr($raw_link, 0, 7) !== '<front>' && !\Drupal::service('path.validator')->isValid(\Drupal::service('path.alias_manager')->getPathByAlias($raw_link, $language))) {
      $form_state->setErrorByName('site_status_message_link', t('You must enter a valid internal path.'));
    }

One final change is I put the error message symbols in <em> tags so that the comma isn't seen as an allowed symbol too!

$form_state->setErrorByName('site_status_message_link', t('Manually entered paths should start with %slash, %question or %hash.', ['%slash' => '/', '%question' => '?', '%hash' => '#']));

I've not made a patch of this, however, but can. Unless you want to check yourself?

Then I'll roll out a release hopefully this weekend. The next step would be to get the form on a separate page as per the 7.x-dev branch, but there's no rush for that.

drupalgideon’s picture

Oh, I've just noticed that the error says you must enter a valid internal path. However, you can add external URLs...!

shkiper’s picture

Hi @SkidNCrashwell. Thank you for your review. Existing validation logic for internal links I took from Drupal core. I changed texts for errors messages. Could you please check new patch?

drupalgideon’s picture

StatusFileSize
new11.65 KB

I have had to make a few changes and included translation.

One thing I noticed was the config wasn't being picked up on install and also it was causing an issue when I uninstalled so I fixed that too

I've attached a patch based off yours. If you could apply this and test (as well as anyone else!) and let me know how you get on.

Thanks

  • SkidNCrashwell authored b86c6f5 on 8.x-1.x
    Issue #2592221 by shkiper, SkidNCrashwell: Does not work with Drupal 8.0...
drupalgideon’s picture

Changes are in DEV branch now. Please test and report back and I will get a stable release out.

drupalgideon’s picture

Issue tags: +Novice
drupalgideon’s picture

Assigned: drupalgideon » Unassigned
Issue tags: +Needs Review
drupalgideon’s picture

Status: Needs review » Fixed

Closing this issue. The latest 8.x version of this module appears to work with D8.

Tests still to write (copies of the 7 version tests) before a stable release is created, however.

Status: Fixed » Closed (fixed)

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