More Substitutions Than I Can View

Google Doc’s equivalent to Word’s AutoCorrect feature (Tools->Preferences->Substitutions) will correct common spelling mistakes. Great feature, I use it a lot. I’ve used it that much I now have more substitutions than I can see; my list currently stops half-way down the words begging with ‘p’.

  1. Has anyone seen this before, or know a workaround for the problem?

  2. For example, is there a way of importing and exporting substitutions?

Skip to webform page from a webform submission view

I’m using Drupal 8 and I have a webform with lots of pages. After submitting the user can see the submission in the webform submission view, but I would like to be able to add an ‘edit’ button on each page sections in the submiton view so the user to be able to go back and edit one page of the webform but without having to click through all the pages.

I have had a look at programmatically skip pages and Jump to Wizard-Page from Preview Page and can add buttons to the webform submission view using the hook:

function theme_preprocess_webform_container_base_html(&$variables) {
//get page 
$webform_page = $variables('element')('#title');

//add button
$variables('value')('#children')('edit_wizard_page') = (
      '#type' => 'submit',
      '#value' => t('Take Action 2'),
      '#name' => 'Take Action 2',
   );
}

But how do you update the $form_state->set('current_page','webform-page-to-load') from the button and trigger a redirect to the page?

8 – How can I inject relevant/filtered ads every 5th result in a view?

I have a view that displays filtered results of Business Offers and Events as “cards”. Now my boss wants to inject relevant custom ads into the results based on the user selected filters (basically, by city/region and business type)…

So, I created another custom content type called “Ads” with fields for multiple images (different sized ads), a click-through url, some tracking details, the type of business the ad is for (like Restaurant, or Venue, etc), and the “market location” (city/region) that the ad would be relevant to display in.

In the twig template file for this view, here are the relevant lines of code that basically inject an Ad placeholder every 5th row:

{% for row in rows %}
  {% if loop.index|trim|last == '5' or loop.index|trim|last == '0' %}
    <div class="card ad">
      <div class="ad_tag">AD</div>
      <div class="advert">ADVERTISEMENT</div>
    </div>
    {{- row.content -}}
  {% else %}
    {{- row.content -}}
  {% endif %}
  {# </div> #}
{% endfor %}

And here’s what that looks like:
Example View Result with an Ad every 5th result/row

My question is…what’s the best way to for me to grab as many unique Ads as possible that are filtered by user selected filters (location and/or business type) of the main offers view…and how can I inject these ads like I have in this twig template?

Some approaches I thought of:

  1. Have the view’s content filter simply get two content types: The original offers…AND the ads. Problem: I don’t know how to control the order of these results such that they will render 5 offers, 1 ad, 5 offers, 1 ad etc…
  2. Possibly create another view just for the Ads and somehow render only one result of this view for every 5th row of the main view Problem: I don’t know how to access and render this data via the twig template, or how to pass the filter values of the main view to the view for the ads via the twig template.
  3. Perhaps I could create a attachment view for the ads with filter values inherited from the main view, initially hide all the ads from view via css, and then use Javascript to move the ad card nodes in between the offer cards every 5th card and then set their css to display again. Problem: My page is already rife with Javascript trickery…and this will be yet another computational expense that will slow down client side responsiveness…

OR…is there a much better approach that I’m just ignorant of (which is very likely, as I only just started using Drupal 8+ this summer)?

Thanks in advance for your help.

NOTE: I realize there are several questions similar to this one, but my question is slightly unique because I’d like to use a few of the user selectable filter parameters of the main view to filter the ads that I’d like to display/inject every 5th row so they are targeted ads

css – How important is zooming in and out (cmd + , cmd – ) for websites (Desktop view) in terms of accessibility?

Short Answer

Browser zoom is probably the most used accessibility feature. Also make sure pinch to zoom works on a mobile as that is used even more.

Long Answer

Lost of people use browser zoom to some extent.

They may not necessarily be disabled.

For example I am currently viewing this site at 150% zoom. This is due to having a 40″ 4k monitor monitor positioned about a meter away. I have no disabilities but without being able to zoom this site the text would be too small to read.

More importantly – the Web Aim low vision survey shows around 44% of assistive technology users use the browser zoom settings.

Web aim survey screenshot

screenshot of webaim survery highlighting 44% of users responded that they use browser zoom as an accessibility feature

How import is zooming in and out (cmd + , cmd – ) for websites (Desktop view) in terms of accessibility?

“very”.

It is very important to allow users to zoom into your site.

I would normally cite WCAG rules here (1.4.4 resize text, 1.4.10 reflow) but I think that would be unnecessary 😉 and instead say that common sense says allow zooming on your site.

Displaying an existing view [closed]

I’m struggling to display existing views built in Drupal 8 in DrupalGap.

Is there anybody that might be able to have a look at what I’ve done to show me what I’m doing wrong?

Help! Mobile view Banner and Top Categories is not showing correctly. Image below

My mobile view is not showing correctly. It happened after rm -rf pub/static/* var/cache/* var/generation/* var/di/* var/view_preprocessed/* generated/* var/page_cache/* Then I Ran static Content Deploy then cleared cache. Now this is my mobile view. Any fix would be greatly appriciated?

enter image description here

How import is zoming in and out (cmd + , cmd – ) for websites (Desktop view) in terms of accessibility?

I am working on a website atm and someone else is in charge of the HTML/CSS side of things.
I’ve noticed it’s not possible to zoom in and out with the browser function of cmd + or -. The website just rescales instantly due to the css.
I don’t know how important this feature is in terms of accessibility. Do people with strong impairments of vision use it regularly or are there other use cases I am not aware of?

list – JSON code to change Default view into Newsletter view

I have created a very basic FAQ using a custom list. I want to use the ‘newsletter’ style but when doing this the search box disappears and it appears only in default view.

As a workaround I found out that is possible to change default view using CSR into Newsletter view and so keep the search box.

Unfortunately I don’t know JSON, does anyone have any suggestion for the code ?

I am using SharePoint 2013 !

magento2 – Magenot 2 SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘databasename.sales_order’ doesn’t exist

I’m getting an error when I navigate to the order grid section of the magento 2.3.4 under Sales -> Orders in the admin panel. It appears to be referencing the wrong table because table ‘databasename.prefix_sales_order’ does exist but below the error is calling table’databasename.sales_order’. How would I fix this?

SQLSTATE(42S02): Base table or view not found: 1146 Table 'databasename.sales_order' doesn't exist, query was: SELECT COUNT(*) FROM `prefix_sales_order_grid` AS `main_table`  LEFT JOIN `sales_order` ON main_table.entity_id = sales_order.entity_id () ()

caching – How to disable CACHE in VIEW PAGE display

The only way I found to add a custom cache tag to a view is implementing a views cache plugin.

Adding the tag as @4k4 suggested doesn’t works. I have tried using different views hooks and different ways without be able to get it working.

With $view->element('#cache')('tags')() = 'custom-data-list' or $view->storage->addCacheTags(('custom-data-list')) the tag appears in X-Drupal-Cache-Tags header, but the view cache is not invalidated when I invalidated the tag.

Then investigating Views Custom Cache Tags module code I found a way to implement it in a custom class:

namespace Drupaldata_viewPluginviewscache;

use DrupalviewsPluginviewscacheTag;

/**
* Add custom cache tags for rows in custom tables.
*
* @ingroup views_cache_plugins
*
* @ViewsCache(
*   id = "table_tag",
*   title = @Translation("Tag for custom tables"),
*   help = @Translation("Tag based caching of data. Caches will persist until any table cache tag are invalidated.")
* )
*/
class TableTag extends Tag {

  /**
  * {@inheritdoc}
  */
  public function summaryTitle() {
    return $this->t('Table tag');
  }

  /**
  * {@inheritdoc}
  */
  public function getCacheTags() {
    // Here you can also create tags for single records in the form "your-table:id"
    return ('custom-data-list');
  }

}

Then in the view settings page, in the Other section, select Tags for custom tables in Caching.

In your code don’t forget to invalidate the cache every time you change a record in your custom table.