You cannot access the AT theme interface anymore when you have a block added from a view where you haven't filled in the description of the block in de the views user interface.
Workaround is obvious but this white screen with "unexpected error" scared the L-D-L out of me and took me a lot of time to figure out what was happening. Would be nice - - just a suggestion -- if you could prevent this in one way or the other like: if no value (NULL?) than no description or text "missing block description" in the list of mobile blocks ... (i know the request for having the friendly description cam from me)

Cheers Guido

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gdelver@xs4all.nl created an issue. See original summary.

gdelver@xs4all.nl’s picture

Issue summary: View changes
Jeff Burnz’s picture

Component: AT Admin » Miscellaneous
Category: Bug report » Support request

By description you mean the "Administrative description" in Views UI?

This description is not used in the theme settings. Afaict this is not even get-able outside of views UI, I see no data or methods for this in the block values.

The theme uses three methods to retrieve data from the block values:

$block_id = $block_values->id();
$plugin_id = $block_values->getPluginId();
$block_label = t($block_values->label());

So I'm not really sure what caused your issue. The theme simply does not use the description, everything it uses is programatically generated by Drupal, even if you leave the label empty Views will fill it in with a machine name.

gdelver@xs4all.nl’s picture

FileSize
107.65 KB

No it is the description for the block it self in the Views UI (see image I included with red arrow). I wondered myself ... but I replayed it yesterday with a new theme (I thought the theme may have broken down for some reason) and the same thing happened when I reloaded al kind of blocks including the block from views that had no blockname. When I filled in the blockname (see red arrow) I could access the theme settings of my AT Theme again. Maybe I am overlooking something here and the reason is somewhere else but I thought I should let you know. My hunch was maybe the fact that you added the friendly name for blocks from views in the mobile blocks setting has something to do with it. The white screen is scary ...

Jeff Burnz’s picture

Status: Active » Closed (cannot reproduce)

That description will become the block name (or label, i.e. $block_label = t($block_values->label());, however this is never empty, it's always set, if there no block name (Block admin description) it uses the View name instead.

Even if it were empty there is no way it would cause a WSoD.

When you do get a WSoD you need to check two things:

1) In Reports > Recent Log messages - to see if something happened (PHP error) at precisely that time and appears relevant) AND
2) The PHP error log, where all errors are logged.

Hunches are not great, PHP and Drupal can almost always tell us what is going wrong.

I can't reproduce this, if you can describe steps that allow me to, then we can reopen it, but as it's being described here it is not reproducible.

gdelver@xs4all.nl’s picture

OK, I get it. I replayed it again by:
1. removing the block name in het ViewsUI while the block is being used and placed in the AT Theme.
2. Going to the theme setting from the specific AT theme - > the white screen appears again (only text visible " unexpected error ...)
3. I picked up the error in the error log -> screencap included.

InvalidArgumentException: $string ("@view: @display") must be a string. in Drupal\Core\StringTranslation\TranslatableMarkup->__construct() (regel 140 van /var/www/vhosts/urootz.nl/devl.urootz.nl/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php).

I hope this helps, Guido

gdelver@xs4all.nl’s picture

Maybe ... some additional info/clue: the site has been installed in Dutch from the beginning (No multi language features and thus additional language installed). I found another error pointing that direction as well (But not related to AT Theme).
Drupal\Core\Entity\EntityStorageException: Invalid translation language (nl) specified. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (regel 770 van /var/www/vhosts/urootz.nl/devl.urootz.nl/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).

=> I tried, under the same conditions, use Bartik and place the same block and try to access the Bartik settings: this time no error... then switching back to the AT Theme and ... bang. It appears to be somehow linked to the AT theme when you access its settings .... The theme itself stays functional.

Jeff Burnz’s picture

Status: Closed (cannot reproduce) » Active

Lets look at the language stuff, could be the reason, when other languages are used some things change in the output.

ABaier’s picture

After an update to the latest devs of adaptivetheme and at tools an hour ago, I got a similar problem. The settings page of my subtheme cannot be opened anymore and only gives me php error. The theme itself seems to be working fine, expect of my main menu styling, which is broken an the responsive menu twig template is not picked up like before.

After checking my views for missing block names, I discovered that an exposed filter block (views search) caused an issue.

Php error log before removing this block:

Uncaught PHP Exception InvalidArgumentException: "$string ("Exposed form: @view-@display_id") must be a string." at /Applications/MAMP/htdocs/pleasuremag2016/www/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php line 140

Unfortunately that did not solve the problem, but the error changed:

PHP Fatal error:  Class 'Drupal\comment\Entity\CommentType' not found in /Applications/MAMP/htdocs/pleasuremag2016/www/themes/adaptivetheme/at_core/forms/ext/shortcodes.php on line 130

Where there any change concerning the templates that I would need to update in my subtheme?

Thanks for your help!

gdelver@xs4all.nl’s picture

@tony4i, Interesting. I run currently the dev version of oct 16. Seems to be working well, since Jeff solved that bug ( and I use a lot of the stuff in the theme). I have still to do the exposed filters though. Which short codes are you using that may cause the problem?
Cheers Guido.

ABaier’s picture

I am also using this version, yes. I activated a bunch of the shortcodes but actually did not use them on the fields inside the settings, I rather wanted to take advantage of them in my scss files.

@Jeff: If I comment out the following part of shortcodes.php (line 130), I can open the AT settings again, without getting the WSoD. That part was added, after the version (rc2+67-dev) I was using before. Would be nice if you could guide me through the necessary changes in my subtheme to keep it up to date and working.

FYI: I am not using any comments on my page so far, so the comment module is uninstalled.

// Comment types
$comment_types = \Drupal\comment\Entity\CommentType::loadMultiple();
$form['shortcodes']['commenttype_classes'] = [
  '#type' => 'details',
  '#title' => t('Comment types'),
];
foreach ($comment_types as $ct) {
  $comment_type = $ct->id();
  $comment_type_name = $ct->label();

  $form['shortcodes']['commenttype_classes']['settings_commenttype_classes_' . $comment_type] = [
    '#type' => 'textfield',
    '#title' => t($comment_type_name),
    '#default_value' => Html::escape(theme_get_setting('settings.commenttype_classes_' . $comment_type, $theme)),
  ];
}
ABaier’s picture

The problem with my responsive menu solved itself, now that I could reach and save the extension settings again.

The issue from #11 still remains.

Jeff Burnz’s picture

Cool, I'll have to try to figure out why the Class is not found, I think that's a downstream effect of something else going on in shortcodes.

I'll do the exposed filter test also - lets see if we can tease out the bugs and/or whats exactly going on here.

Jeff Burnz’s picture

I've added a check for comment module so that will be safer now. Exposing the filter did not cause me any issues.

If anyone gets a similar issue please view your PHP error log and the Drupal logs and post them here (like #9), this is the most useful thing for me.

If you can then save the theme settings - I suspect this issue might occur with an update to Adaptivetheme dev.

ABaier’s picture

Just to let you know, the check mentioned in your previous post solved it for me. Thanks!

antoinetooley’s picture

How did you solve it?

I am getting this:

InvalidArgumentException: $string ("@view: @display") must be a string. in Drupal\Core\StringTranslation\TranslatableMarkup->__construct() (line 140 of core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php).

THanks!

Jeff Burnz’s picture

@ #16 yes, I just ran into this myself, I have removed some of the translations in forms for blocks (Mobile blocks and Shortcodes): http://cgit.drupalcode.org/adaptivetheme/commit/?id=c7cb7cc

This solves your issue.

Jeff Burnz’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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