Comments

joyceg created an issue. See original summary.

joyceg’s picture

StatusFileSize
new1.91 KB
joyceg’s picture

Status: Active » Needs review
joyceg’s picture

StatusFileSize
new2.72 KB
naveenvalecha’s picture

Status: Needs review » Needs work

This needs reroll

joyceg’s picture

StatusFileSize
new2.29 KB
joyceg’s picture

Assigned: joyceg » naveenvalecha
Status: Needs work » Needs review
naveenvalecha’s picture

Assigned: naveenvalecha » Unassigned
StatusFileSize
new3.33 KB

Here's the patch that will also resolve the template not found issue on the admin/config/search/pages page

naveenvalecha’s picture

StatusFileSize
new3.33 KB
naveenvalecha’s picture

StatusFileSize
new3.23 KB

Fixing coding standards in twig template.

naveenvalecha’s picture

Now the explanation of the changes :

  1. +++ b/search_config.module
    @@ -13,15 +13,14 @@ use Drupal\Core\Url;
    + * Implements hook_theme().
    

    Coding standard fixes.

  2. +++ b/search_config.module
    @@ -13,15 +13,14 @@ use Drupal\Core\Url;
    -      'template' => 'templates/search-config-admin-labels-form.html.twig',
    

    we don't need to explictly pass the template name. btw if you'll not pass the template name then it is same as the array key being returned. like in this case the twig loader will search for template templates/search-config-admin-label-form.html.twig

    Now why the name is search-config-admin-label-form.html.twig ?
    Because the key is "search_config_admin_label_form" so the template name converted to .html.twig by converting _ with -

  3. +++ b/templates/search-config-admin-label-form.html.twig
    @@ -0,0 +1,31 @@
    +{% set labels = form['#field-labels'] %}
    

    Fixed coding standards in twig template. From tab to two spaces.

naveenvalecha’s picture

Now Review of #10 :

have you tested the patch ? Nothing showing on the path admin/config/search/pages ?
Please test and update the patch accordingly.

Also make sure that you have coding standards configured

smaz’s picture

Status: Needs review » Needs work

I've applied this patch against the latest dev version of search_config, against drupal 8.2.x dev.

It's not working for me I'm afraid, I get WSOD errors from twig issues.

I'm currently trying to work through them & update the patch, if I don't get it finished in time I'll post my progress + updates on the errors I'm having.

smaz’s picture

I'm still struggling to get the patch in #10 to work, so here's my notes - I'm not quite sure what the form is supposed to be displaying, so I'm not sure what I need to fix.

1) "Twig_Error_Syntax: An array element must be followed by a comma. Unexpected token "punctuation" of value ":" ("punctuation" expected with value ",") in "modules/contrib/search_config/templates/search-config-admin-label-form.html.twig" at line 3. in Twig_TokenStream->expect() (line 87 of /var/www/site/docroot/vendor/twig/twig/lib/Twig/TokenStream.php).

In Twig, arrays can't have named keys - instead, it is what they call a 'hash':
https://mijingo.com/blog/key-value-arrays-in-twig

Twig doesn’t refer to a key, value array as an array. It calls it a hash.

A hash is one of several types of literals available in Twig. It has a key and a value. The pairs are separated by a comma and enclosed in curly braces.

So instead of:
{% for form_key, form_name in ['basic':'Basic'|t, 'advanced':'Advanced'|t] %}
It should be:
{% for form_key, form_name in {'basic':'Basic'|t, 'advanced':'Advanced'|t} %}

2) Line 12 is just plain text, it should be wrapped in {% %}

set has_title_display = false
Should be:
{% set has_title_display = false %}

3)

Twig_Error_Syntax: Unexpected token "operator" of value "is not" in "modules/contrib/search_config/templates/search-config-admin-label-form.html.twig" at line 13. in Twig_ExpressionParser->parsePrimaryExpression() (line 190 of /var/www/site/docroot/vendor/twig/twig/lib/Twig/ExpressionParser.php).
{% if is not null attribute(form.['title-display'], key) %}
  {% set has_title_display = true %}
{% endif %}

I believe the twig syntax is:

if (variable) is not null

So I've managed to get this line to work (or at least not provide fatal errors) by changing it to:

{% if attribute(form.title-display, key) is not null %}
  {% set has_title_display = true %}
{% endif %}

That's as far as I've got - after fixing the above issues, the page loads however the "LABELS AND STRING OVERRIDES" table is blank on each row. I'm not sure what should be displayed, so I can't go any further.

joyceg’s picture

StatusFileSize
new1.88 KB

Thanks smaz for your suggestions.
Attaching the improved patch here. It is resolving the white screen issue.

joyceg’s picture

Assigned: Unassigned » naveenvalecha
Status: Needs work » Needs review
joyceg’s picture

StatusFileSize
new3.23 KB

Please ignore #15. This is the required patch here.

smaz’s picture

StatusFileSize
new84.69 KB

I've just tried the patch in #17:

It fixes the white screen issue, but I'm still not getting any content in the 'LABELS AND STRING OVERRIDES' section. See the attached screenshot.

What should be displayed here? If you could provide a screenshot or description, I can try to work out why that is.

I could do with this module on a project at the moment, so happy to try & help where I can.

Cheers :)

joyceg’s picture

StatusFileSize
new39.7 KB

It has to be of the form like:

naveenvalecha’s picture

Assigned: naveenvalecha » joyceg

back to N/W for #18, Assigning to joy to test it and check what's needful for it.

joyceg’s picture

Assigned: joyceg » naveenvalecha
StatusFileSize
new3.95 KB
naveenvalecha’s picture

Assigned: naveenvalecha » joyceg

Interdiff please

naveenvalecha’s picture

Assigned: joyceg » Unassigned
Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.21 MB

Reviewed the whole patch again.looks good.
One problem that I found is in the ttached screenshot. Please file a seperate issue for the same.

Search Configuration

  • naveenvalecha committed b434a22 on 8.x-1.x authored by joyceg
    Issue #2763895 by joyceg, naveenvalecha, smaz: Work on Template...
naveenvalecha’s picture

Status: Reviewed & tested by the community » Fixed

Thanks! Committed and pushed to 8.x-1.x

Status: Fixed » Closed (fixed)

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