Elementor常见错误和解决方法汇总

精益生产管理

Elementor是一款功能强大、灵活的WordPress页面构建器,使用它可以轻易搭建出时尚、功能强大的响应式页面,因此备受欢迎。Elementor功能很强大有众多小部件可以实现各种功能和排版,而且设置多种多样很人性化。然而大家在使用Elementor的过程中,或多或少都会遇到各种小问题和错误提示,本文为大家汇总了Elementor常见错误和解决方法。

1、 Elementor小工具面板加载失败

最常见的 Elementor 错误包括 Elementor 部件面板无法加载。当使用大量插件、多个元素插件或服务器 PHP 内存有限时,Elementor 部件就会停止加载。

解决方法:《Elementor加载缓慢如何解决?》

2、 Elementor内容区域缺失错误

“Sorry, the content area was not found on your page. You must call the_content function in the current template in order for Elementor to work on this page.”(”抱歉,您的页面上未找到内容区域。您必须在当前模板中调用 the_content 函数,Elementor 才能在此页面上运行。)

  • 方法 1:换一个主题是最简单的方法。GeneratePress 主题是最兼容 Elementor 主题之一。
  • 方法 2:如果不想更换主题,也可以试试这个方法。在页面模板的代码中添加 the_content 函数,只需添加 <?php the_content(); ?> 一行即可

3、Elementor页面空白错误

如果在尝试使用 Elementor 编辑时出现空白页面,可能是因为 WP 内存不足,可以检查网站是否满足Elementor的系统要求。

  • 方法 1:增加网站的 WP 内存。
  • 方法 2:可以试试这个故障排除步骤。进入 WP 控制面板 > Elementor > Settings。点击 “Advanced” 选项卡,启用切换编辑器加载器方法,然后检查问题是否解决。
  • 方法 3:在某些情况下,这可能是因为后端的 URL 与前端的 URL 不同。
  • 方法 4:尝试停用任何 Elementor 附加组件或其他插件,看看是否有帮助。

4、如果使用Elementor编辑时出现灰色页面

如果出现灰色页面,可能是由于插件冲突造成的。如何解决使用 Elementor 编辑时出现灰色页面的错误?

  • 方法 1:您可以逐个停用插件(Elementor 和 Elementor Pro 除外),然后确定是哪个插件导致了故障,从而解决这个问题;也可以尝试停用 Elementor 附加组件。
  • 方法 2:这个问题的根源有可能是浏览器中的某个扩展。为了仔细检查,请尝试使用其他浏览器打开 Elementor 编辑器。

5、无法用Elementor编辑页面错误

如果试图编辑页面,但却一直被重定向到实时页面,这可能有两个原因。要么是插件冲突,要么是内存问题。解决办法如下:

  • 方法 1:如果是内存问题,提高网站的 PHP 内存限制。
  • 方法 2:可以逐个停用插件(Elementor 和 Elementor Pro 除外),并找出是哪个插件导致了问题,从而解决这个问题。

6、Elementor更改不起效错误

可能会出现这样的情况:您做了更改,但发布时却没有显示样式。出现这种情况可能是因为缓存问题。解决办法可以参考以下5钟办法:

  • 方法 1:进入 WP 管理 > Elementor > Tools > Regenerate CSS & Data,即可轻松解决这个问题。然后,您可以清除缓存(WP 缓存和浏览器缓存)并刷新页面。
  • 方法 2:检查网站上是否有缓存插件或启用了服务器级缓存。清除这些缓存。
  • 方法 3:清除浏览器缓存或在私人/隐身窗口中检查网站。
  • 方法 4:这个问题可能是主题造成的。您可以尝试更换为 WordPress 的默认主题,如果问题得到解决,请联系主题的开发人员。
  • 方法 5:如果你在使用 Elementor 的同时还使用了其他页面生成器,那么它可能会覆盖你用生成器创建的内容,从而停止显示更改。要解决这个问题,请保存模板,然后将其添加到新页面中,这样就能解决问题了。

7、Elementor发布/更新按钮不可用错误

与大多数问题一样,造成这一问题的原因是内存不足。

方法 1:这可以通过 WP 内存限制来解决,以满足运行 Elementor 的最低要求。

方法 2:有时,当 admin-ajax 脚本超时时也会出现这种情况。要确认这一点,请按 F12 键检查控制台是否出现任何错误信息。如果出现 “加载资源失败:服务器响应状态为 413 “的信息,请在 .htaccess 文件中添加以下指令,以延长动态超时时间。

<IfModule mod_dtimeout.c> <Files ~ ".php"> SetEnvIf Request_URI "admin-ajax.php" DynamicTimeout=150 </Files> </IfModule>

方法 3:这也可能是由于服务器上设置的参数造成的。你可以通过在网站上添加 SSL 认证来解决这个问题。之后,您需要在 WP 控制面板的 Elementor > Tools > Replace URL 中更改网站的 URL。

方法 4:如果尝试更新页面时出现 403 错误,则是由于安全插件造成的。要解决这个问题,请激活插件的学习模块或联系他们的支持。

8、使用Elementor时出现500错误

500错误是服务器问题,您可以自行解决。如果您在使用 Elementor 时遇到 500 错误,必须查看服务器的错误日志来了解问题所在。

  • 方法 1:内存限制问题是导致此问题的原因。要满足 Elementor 的要求,内存至少应设置为 128 MB,增加 PHP 内存限制。
  • 方法 2:可以停用插件(Elementor 和 Elementor Pro 除外)和任何 Elementor 附加组件,并将 WordPress 主题更改为默认主题,如 Twenty Seventeen,以排除与第三方产品的冲突。

 

分类:新闻资讯

标签:Elementor

Elementor加载缓慢如何解决?

数字化转型

Elementor是一个免费的WordPress页面构建器插件,拥有超过500万个活动安装。此外,该插件还具有高级版本和数百个附加组件,可在您的网站中添加精美的元素。与任何其他页面构建器插件一样,Elementor添加了自定义样式和脚本,为页面的前端外观添加了令人惊叹的因素。但是,它会在前端和后端影响您网站的页面加载速度的高成本。那么Elementor加载缓慢如何解决?

1、 仅对页面启用Elementor

默认的WordPress设置允许您创建两种文章类型——文章和页面。此外,像WooCommerce这样的插件将创建产品,您还可以根据需要创建自定义文章类型。我们强烈建议只为页面启用Elementor,而不是为文章和其他自定义文章类型启用。这有助于在前端和后端禁用除页面之外的Elementor资源的加载。当您激活Elementor插件时,它将默认为文章和页面启用。您可以转到“Elementor > Settings”菜单并在“General”选项卡下禁用文章插件。

2、 使用Elementor Experiments

该插件在“Experiments”选项卡下提供了许多实验性功能。在这里,您可以看到正在进行的实验以及已完成并被接受为稳定功能的实验。为了提高加载速度,您可以在稳定和持续部分下启用所有与速度相关的项目。

3、优化字体使用

使用Google字体和其他自定义字体会在Google PageSpeed Insights中产生很多问题。例如,当您使用带有Elementor插件的Google Fonts时,您会看到在加载Web字体和预加载字体时使文本可见的警告。幸运的是,Elementor具有内置的字体优化选项,您可以使用它们来提高页面加载速度。

4、使用外部CSS文件

正如您在上面的屏幕截图中看到的那样,Elementor允许两个“CSS Print Method”选项。一种是使用“External File”,另一种是使用“Internal Embedding”。选择“External File”选项,以便将所有CSS样式作为外部文件加载。之后转到“Elementor > Tools > General”部分,然后单击“Regenerate Files & Data”。这将重新生成数据并作为外部CSS文件加载。它将有助于正确缓存页面并提高速度,而不是动态注入无法缓存的CSS。

5、尝试安全模式

如果您在创建或编辑页面时遇到加载缓慢的Elementor编辑器,则可以使用“Elements > Tools > General”部分下的安全模式。安全模式会在加载缓慢时在编辑器中显示建议。

6、 减少附加组件的数量

有数百个第三方插件可用作Elementor页面构建器插件的附加组件。这些插件将为基础插件添加额外的元素以创建漂亮的布局。但是,这些插件可能无法很好地与父Elementor插件一起使用,尤其是当父插件更新到较新版本时。此外,附加组件将添加额外的CSS/JS并增加HTTP请求。如果您喜欢 Elementor,请转到提供足够元素和模板库的 Pro 版本。避免使用第三方插件来添加一些可能会降低您网站速度的元素。

分类:新闻资讯

标签:Elementor

9 Companies that Use React

Faster time to enter the market, reusability of components, the richness of design, programming and debugging tools are just some of the reasons why well-known companies chose React to build or rebuild their web applications. Below, I present the list of brands using React and the reasons why it was chosen.

Facebook

Let us start with a curious detail: Facebook is the place where the React.js library was created. Its author is Jordan Walke, a Facebook software engineer who developed a prototype called “FaxJS”, and who was inspired by library components for PHP.

At this point, it should be noted that Facebook is not only a social platform but – above all – a technological company whose goal is to develop technology and share resources with its users. Thus, React turned out to be a way to involve more developers in relation to open source also.

When can you see the functionality for which React is responsible on Facebook? Especially when the key elements of a page load immediately when it is being updated. Thanks to this, you receive the updated information. This is reflected, for example, when the latest update, comment or like of a friend from Facebook appears – as you know, there is no need to reload the entire page. You can interact then, click “Like”, “Share” buttons, etc. – and still get an immediate response from a webpage, without having to load a page.

Atlassian

Atlassian is a world-famous Australian brand that owns, among others, such products as: JIRA, Confluence, Bitbucket, Trello, Hipchat. And almost all of them are being built using React.js.

Atlassian used key React functions to easily introduce changes on all devices: desktop, Internet and mobile ones.

Atlassian experts argue that there is an exciting future lying before React, both in terms of opportunities for developers, but also because of the growing interest in it.

UberEats

Most people probably know this brand, but maybe not everyone knows that browsing, ordering and tracking orders is the result of using React.js.

Thanks to it, the restaurant dashboard was developed, which can be accessed via smartphones or tablets. The UberEats team decided that restaurants need a seamless way to communicate with both suppliers and consumers.

They wanted a solution that would meet various requirements, including:

  • placing a new order,
  • accepting an order,
  • arrival of a delivery man, 
  • execution of an order.

The most important, however, seems to be the fact that React has made it possible to improve the user experience of the web application, which you can see for yourself when using the application.

Netflix

The absolute leader in its line of business. In 2015, Netflix used React to redesign its UI. The decision came from the need for improving:

  • launching speed, 
  • performance, 
  • modularity. 

Over the course of five years, the website has undergone numerous changes and updates, but React remains the main tool for creating its front-end.

Thanks to the user-friendly interface, you can easily go through the authorisation and logging-in process, and the intuitive website design, as well as the convenient filtering, help to find what users are looking for. The application includes many features for content management: Ultra HD 4K, HDR, Dolby Vision, Play Netflix.

Airbnb

Component reusability was also an argument for Airbnb’s choice of React. The Airbnb developers have actively contributed to the development of the entire React ecosystem, which resulted in creating the React Sketch.app library. It is a library that aims to serve as a support bridge for cooperation between some design works and programming works. The React components are responsible for rendering documents in Sketch.

Dropbox

Starting in 2012, the developers at Dropbox began taking steps to improve the service. At that time, one of the problems was the fact that many engineers contributed to the codebase, but only a few were aware of what was actually going on within the website. In 2016, React was selected in order to start redesigning the library.

Have you noticed how quickly you can preview any document at Dropbox? When gathering file data, React analyses the number and size of pages, visualising a preview as the page is being scrolled down. The Dropbox team used a combination of React and other JS tools to ensure smooth operation across all browsers.

Codecademy

The company offers coding courses, including such languages as: Java, Python, SQL, C ++. It is a well-known educational platform.

React is an integral part of the library; it is one of the key scripts integrated with the Codecademy structure – the header, menu and navigation among them. Arguments for using React, pointed out by Codecademy, were its ease of use, SEO-friendliness, and flexibility.

In addition, it is great for front-end building and interfaces development with JavaScript. In addition, it should be emphasised that animations are also created using React, and it is worth noting that they will appear with minimal coding. The company really wanted the interface to remain as attractive as possible.

Skyscanner

Moving on the topic of design, another example is a website – and more precisely a large internet search engine – enriched with information about flights around the world.

In 2019, Skyscanner decided to redesign so widely that the development team created an entire design system – Backpack. This is important enough to mention because this system is based on React components. The main goal of the developers was to create a coherent, clear interface for all users. The programmers wanted the UI/UX design and the brand appearance to be impeccable.

Zendesk

It is a software development organisation that offers SaaS solutions with features such as tracking, problem monitoring, help desk management and customer service. The company is committed to ensuring easy and effective communication with its clients.

Zendesk is the author of Garden – a system to assist with design. And it was in Garden that React components and tools were used to offer visualisation, localisation or navigation.

Summary

Companies eagerly adapt to the technologies thanks to which they can shorten the time of entering the market with a new product. This is an extremely important argument in the context of business and expected profits. The issue of technology stability is essential here, especially in a situation where other technological solutions appear and disappear.

As I mentioned in the introduction, React comes with a rich suite of design, development, and debugging tools. The React developer tools are available for some browsers such as Chrome and Firefox. With React, you can reduce wasted time, improve user experience, and provide better application performance.

As you can see in the examples above, React is one of the most popular and reliable front-end frameworks used by many companies. That is why at Droptica we put an emphasis on the React.js development services, and most importantly – we know how to use React.js with Drupal.

8 Ecommerce Blogs to Follow for Valuable Business Insights

There are many sources of knowledge about the ecommerce industry for budding entrepreneurs and seasoned businessmen: online discussion groups, trade magazines, conferences, and many more. On ecommerce blogs, you can find articles on various topics and of varying complexity so it’s a good place to search for information on online stores, track the trends and news from the industry.

Ecommerce blogs – why should you stay up to date?

A blog isn’t only an effective brand promotion tool but also a place where readers can find tips that are useful for business.

The advantages of following blogs include:

  • gaining knowledge about the ecommerce industry, technology, marketing, SEO positioning, dropshipping, running a store, the issues related to running an online business,
  • making contact with other people from the industry (the author or other readers) in the comments to exchange views or start collaboration,
  • getting quick information about the industry news by subscribing to a newsletter or blog,
  • the ability to download reports, analyses, and other materials sent to blog subscribers and not available to the public.

1. Digital Commerce 360

Digital Commerce 360, formerly known as InternetRetailer, is a huge information platform with articles published in two sections, one about the B2B sector and another, which hosts materials about retail trade. The articles for this page are created by various authors, including industry journalists and people with hands-on ecommerce experience (company CEOs, product team leaders). They focus on industry news, technologies, technological solutions for business and the creation of reports on the ecommerce market.

In addition to reading publicly available articles, readers can purchase access to a large number of useful reports, as well as economic and ecommerce research (e.g. to a report on marketplaces or research on web page design and customer experience).

Digital Commerce 360 looks like an ordinary business magazine because the entries don’t resemble the compendiums of knowledge typical of industry blogs. On ecommerce blogs, entries often consist of many definitions and “raw” knowledge, allowing the reader to delve into a topic that is new to them. The articles on Digital Commerce 360 focus more on actual events in the world of online stores, opinions and statements of the people from the ecommerce industry.

2. E-commerce Nation

E-commerce Nation is another big portal that publishes articles related to the ecommerce market. In addition to regular authors specializing in the ecommerce industry, the editorial office is also open to materials created by independent authors. You just need to create your own profile on the page. The final modifications and the decision to publish it, however, are left to the regular team. Its editors categorise the published content into seven different thematic categories:

  • logistics,
  • payments,
  • m-commerce,
  • marketing,
  • conversion,
  • cross-border,
  • ecommerce platforms.

Source: E-commerce Nation

This page is a huge knowledge base for beginners and experienced ecommerce professionals. In addition to the blog itself, on the page you can find webinars, podcasts, e-books, infographics, as well as a separate subpage with interviews with the people well-known in the ecommerce industry (such as Frieder Egerman, who started his career at Yahoo! or Clark Boyd, specializing in digital marketing, who collaborated with American Express and Adidas).

3. EcommerceBytes

EcommerceBytes is a blog founded by Ina Steiner, an often quoted by ecommerce journalists specialist in selling on marketplaces, and the author of Turn eBay Data Into Dollars. By browsing the published news from the ecommerce industry, you’ll learn what is happening at the largest ecommerce companies in the world, such as eBay and Amazon.

The site consists of three blogs: EcommerceBytes, AuctionBytes and Letters to the Editor. Letters to the Editor is a blog, co-created by the readers. Anyone can describe a certain problem or situation. It’s also worth mentioning that the readers can reply to every letter. Therefore, a discussion arises between the members of the community, and readers can learn not only from the person who wrote the letter, but also from other people leaving comments. AuctionBytes is written by salesmen running their own online stores and selling on marketplaces, and it addresses the current problems of these entrepreneurs. The third blog – EcommerceBytes – contains the news published by the founder of the site. The articles on this blog are aimed mainly at those who like to keep their ear to the ground, and whose business decisions may depend on the moves of big brands. Among the news, however, you can also find more extensive texts on the new trends in ecommerce (e.g. drone deliveries, methods of monitoring the employees working remotely, or the possibility of using artificial intelligence).

The Tools tab contains industry guides written by the readers, e.g. about international shipments and the strategies related to them. An interesting idea was also to create the Ecommerce EKG section, where readers can report information about the errors or difficulties they found on various ecommerce platforms. It’s possible to subscribe to the newsletter in order to be up to date with the new entries.

4. eCommerceFuel

The eCommerceFuel blog was created on the initiative of the entrepreneur Andrew Youderian, and today many ecommerce experts publish on the platform. In addition to the moderators, editors and employees responsible for supporting the community, the blog is also co-created by specialists in various fields, e.g. email marketing or product shipping. Readers will find on this platform numerous articles about:

  • sales optimization,
  • business scaling,
  • branding,
  • SEO,
  • influencer marketing,
  • photography,
  • video creation,
  • transport.

Among the materials, you can find content in various forms. Extensive specialist articles, industry news, annual reports on the ecommerce trends and training courses are available to interested readers. The podcasts created by the site founder are a large part of the content that makes up the blog. Sometimes by himself, and sometimes with the invited guests, he talks about creating one’s own brand and business, referring to his own story. He mentions, for example, how living in two different places at once had an impact on his career.

Excerpt from the report on the ecommerce trends in 2019. Source: eCommerceFuel

The recipients of the materials published on eCommerceFuel create an active community. The membership is paid, but after joining the forum, you’ll be able to participate in discussions with other entrepreneurs and have access to the materials available only to people belonging to the community. Closed networking meetings are also held.

5. A Better Lemonade Stand

A Better Lemonade Stand is a blog founded by Richard Lazazzera – an entrepreneur, advisor and investor from the ecommerce industry. He was developing the Shopify platform before deciding to seriously focus on developing his blog. Originally, his site was in the form of a blog, where the entrepreneur shared with his readers his own experiences gained while creating and running an ecommerce company. Today it’s created by many authors, and some guest texts sent by readers are also published.

This blog is aimed at a wide audience – both novice entrepreneurs and experienced experts from large corporations who are able to shape the ecommerce industry will find useful knowledge there. You can find entries about ecommerce platforms, interesting marketing tools, using various communication channels for promotion and many other materials.

Source: A Better Lemonade Stand

The texts on the blog can be filtered according to the phases of business development the text relates to (“build, launch, grow”). When browsing the articles in the section about the business building phase, we’ll find texts about interesting business ideas and general tips on ecommerce. In the texts on launching a store on the market, we can find information on interesting technologies and marketing. You’ll learn from them how to promote your own business. The publications on the growth phase include evaluations of useful business tools and tips on how to scale your business. It’s worth subscribing to the newsletter in order to receive notifications about the texts you are interested in.

6. Ecommerce Platforms

Ecommerce Platforms is a blog founded by Catalin Zorzini. The author is the creator of the Mostash content marketing agency, he recently released a free mindfulness app with Zen teachings and built the ethical.net page, which enables finding ethical alternatives to the mainstream products and services.

Ecommerce Platforms is a page almost entirely devoted to online store building software and related technologies. We can find comparisons of ecommerce platforms, and information about the latest software versions. You can also expect mentions of payment systems, reviews of IT solutions for ecommerce and industry news.

On the blog, we can find two interesting subpages: Resources and Definitions. The first one contains links to the software, tools and articles recommended by the author. The second contains an alphabetical list of ecommerce terms. After clicking the query, we are redirected to the definition of a particular issue.

7. Sylius blog

Sylius is a Symfony-based system for building online stores. On the official website of this solution, there’s also an industry blog with many interesting entries about ecommerce solutions.

Source: The Sylius blog

On the blog, you can find information aimed at developers, about the possibility of using this software to build an online store, and tutorials on creating and developing an ecommerce website. In addition, there are also published articles about the current trends in the industry, business strategies, and available Sylius functionalities for stores – such as the possibility of integrating various payment methods, availability of analytical tools, etc.

8. Droptica blog

We also invite you to follow our blog. The ecommerce entries are an important part of its content. The articles on online business constitute a solid dose of knowledge about the industry and interesting solutions such as Drupal Commerce and Sylius, which we implement.

Our blog will certainly be of interest to you, regardless of whether you are already active or just a beginner in the ecommerce industry. If you’re wondering which technologies are most suitable to meet your specific business needs, we’ll be happy to share many interesting facts about store design. We advise between choosing a marketplace and an ordinary online store. We also advise on how to approach the sale of electronic products and show what interesting functionalities for ecommerce you can implement at your store.

Ecommerce blogs – summary

It’s worth following popular blogs from the ecommerce industry and absorbing the news. This way, you can efficiently learn about the trends and solutions that you may later use in your own business. Browsing through multiple pages can be time-consuming, so be sure to subscribe to your favorite blogs to get notifications. Subscribe to the Droptica blog to find out what’s new in the ecommerce industry.

Keyword: drupal agency

7 Tricks for Creating a Drupal Theme that You May Have Never Heard Of

Theme creation in Drupal is not as easy as it may seem. Therefore, there is space here to make your work easier. Often, however, we take shortcuts for this purpose, but these do not always bring the desired results or contradict Drupal’s philosophy and generally accepted best practices.

Probably many of you know that as in any other CMS or framework we work on, in Drupal, we can achieve the same goals by choosing different paths to reach them. In the course of my experience, I have faced common mistakes made by Drupal beginners repeatedly, and I have managed to track many codes created by novice and experienced Drupal developers. I have seen how much different the approaches they use. As part of this article, I would like to introduce 7 tricks I have selected (or just shortcuts) that make it easier to work on creating a theme, which many programmers I have never heard of.

Due to the fact that with each release of the Drupal subversion there are various significant changes, I would like to emphasize the examples discussed here that are compatible with the core 8.9.x version. All presented tricks, although they may be sometimes controversial in use, they are fully consistent with the art and can be used for projects.

1. Use of the #context key in the rendering array

One of the common problems when creating templates is the ability to pass data between them. This usually requires programmers to perform complex operations, e.g. when processing templates. The challenge becomes even more difficult when some hooks have already been cached and data upload was still needed. There may be many ideas for solving the problem, but with the Drupal 8.8 version, the problem is solved by the #context key.

Suppose we have implemented hook_preprocess_node, in which we add some additional element using a dedicated template, but we would like to still have access to the node object in it. This is where the #context key comes in handy.

function my_module_preprocess_node(array &$variables) {
  $node = $variables['node'];

  $variables['my_custom_element'] = [
    '#theme' => 'my_custom_theme',
    '#title' => t('My custom theme title'),
    '#context' => [
      'entity' => $node,
    ],
  ];
}

This makes it possible to pass any data from one rendering table to another. You can fit anything in it, e.g. an instance of an object that we will need in further processing:

function my_module_preprocess_my_custom_theme(array &$variables) {
  $node = $variables['#context']['entity'];
  // Do whatever you needed with the node entity in your custom theme...
}

It’s worth mentioning that this variable is also available in hook_theme_suggestion_alter, which can further facilitate making suggestions for additional context-dependent template names.

2. Cache support in twig templates

More and more demanding graphic designs of websites, as well as page optimization (in terms of the amount of HTML code returned), forces us to use some shortcut solutions, e.g. extracting the field value directly in the entity template (node type).

Solutions such as

{{ content.field_my_reference_field.0 }}

displaying only single field instead of the content variable can have disastrous consequences in the form of cache problems. In the rendering arrays, apart from the final HTML code, there are also keys responsible for storing such cache metadata: tag, context and max-age. If you want to be sure that the metadata will be collected correctly by the renderer service, just add one magic line in the template:

{% set rendered = content|render %}

In the example of a node template, it will be the content variable, but it can be any “main” variable of your template. Passing such a main rendering array through the render filters allows you to correctly collect all cache metadata, without having to display the entire content variable. At the same time, the solution does not have any negative impact on the performance of code execution, as long as we use cache mechanisms.

3. Theme suggestion without using hook_theme_suggestion_

Yes, it sounds like something completely crazy. However, this solution is available “out of the box”. It is enough to add the suggestion to the values hidden in #theme or theme_hook_original in any rendering array (e.g. in hook_preprocess_HOOK) keeping the template naming convention.

As a result, the variable value set in this way

function my_module_preprocess_paragraph(array &$variables) {
  $paragraph = $variables['paragraph'];

  if ($paragraph->bundle() === 'my_awesome_bundle') {
    $variables['theme_hook_original'] = 'paragraph__my_custom_theme_suggestion';
  }
}

records a suggestion for a given base template (paragraph), allowing you to create a template file named: paragraph-my-custom-theme-suggestion.html.twig Nevertheless, I would limit this solution to exceptional cases. For general use, I would recommend a hook dedicated for this purpose.

4. Safe filter replacement | raw

This filter is generally considered to be potentially dangerous (increases the possibility of successful XSS attacks) and is used in single cases. But it should be avoided as much as possible. I suggest looking for a better way, especially since one of them is extremely easy to use, as you will see in an example.

Let’s assume that we have a field that is to finally display the image, but for some reason we would like to omit all the HTML code generated along the way.

The easiest way to do this is:

{{ content.field_my_image_field|render|striptags('<img>')|trim }}

Experienced Drupal developers know that such a solution, instead of displaying an image on the page, will display the whole as plain text encoded into HTML entities. Yes, you can add a raw filter, but you can do it differently using Drupal’s Render API with the #markup key:

{{ {'#markup': content.field_my_image_field|render|striptags('<img>')|trim} }}

The method is perhaps a bit less readable than with the filter, but it is safe. HTML code will still be filtered here and only allowed safe tags will be passed through.

5. Referencing a template file from a different theme/module

If you haven’t used Twig mechanisms such as include, embed or extend in your template files, I suggest to take the DRY rule into account in every aspect of programming (or web development in general). Themes are the places that suffer most from duplicate code, both in template files and in style sheets.

Many times I have encountered the entire template file was copied, e.g. from an inherited theme or a module, only to add some surrounding HTML code or modify a single template block. The same effect can be achieved by referring to a parent file using the aliases @module_name @theme_name. Suppose we have a template file (card) in our sample module named custom_card

<div >
  {% block card_header %}
    <div >{{ header }}</div>
  {% endblock %}
  
  {% block card_content %}
    <div >{{ content }}</div>  
  {% endblock %}
  
  {% block card__footer %}
    <div >{{ footer }}</div>
  {% endblock %}
</div>

And now in our theme, we would need to add some additional elements in the header block, e.g. an icon. The most common thing is to copy the entire template code, but this can be done more simply and without repeating the code:

{% extends '@custom_card/card.html.twig' %}

{% block header %}
    <div >
      <div >{{ icon }}</div>
      {{ header }}
    </div>
{% endblock %}

6. View reloading using InvokeCommand

As you know, the Views module allows to create views that use AJAX technology. This is done to dynamically switch between the different pages of the view, but also to display the results of the response to value changes from the provided form. But what to do when the content of the view needs to be refreshed due to performing some action outside it, e.g. after sending a request to the controller from another block? Or to submit a form on the same page? Well, there are two very convenient functionalities available in the Drupal core.

The first one is the default RefreshView event registered on the view, which causes the view to be refreshed using AJAX (I recommend that you enter it in the browser console on your example view and observe the effect).

The second mechanism is InvokeCommand, which allows in the AJAX response to return the jQuery method call, along with the given parameters on the DOM element. Combined, this gives you this example code:

class MyCustomController extends ControllerBase {

  /**
   * Perform the update and refresh the view.
   *
   * @return DrupalCoreAjaxAjaxResponse
   *   Ajax response.
   */
  public function doUpdateAndRefresh(): AjaxResponse {
    // Perform some sort of logic needed for your controller.
    $this->doUpdateOperations();

    // Refresh the view.
    $response = new AjaxResponse();
    $response->addCommand(new InvokeCommand('#my-view-block', 'trigger', ['RefreshView']));

    return $response;
  }

}

In my example, there were forms for user approval inside the generated view. In response to the entry of such a form, I needed to display an updated list. As you can see, basically one extra line did all the magic without any extra effort.

7. Use of Drupal.debounce

For the very end I want to describe something which is not so much a trick as good practice. The Underscore.js library is bundled with Drupal core, but many developers do not use it at all. It includes a number of functionalities. One of the most common cases where the capabilities of this library are not used is the so-called deboucing, i.e. preventing multiple code execution in response to a given event – most often it is a change in the width of the browser window.

I have come across code many times that resembled:

function onResize(callback) {
  var timer;
  return function (event) {
    if (timer) {
      clearTimeout(timer);
    }
    timer = setTimeout(callback,100, event);
  };
}

$(window).resize(onResize(function(e) {
  // Resize implementation goes here.
}));

Of course, this is an exemplary and the simplest implementation, and such code will execute correctly. The question is: why reinvent the wheel? Answer: to improve Drupal compatibility in the core of Drupal, and also to increase the convenience of work for developers – there is a debouncer port from the underscore library.

Just add a dependency to your library

- core/drupal.debounce

and add the following implementation in the JS code:

$(window).resize(Drupal.debounce(function () {
  // Resize implementation goes here.
}, 100));

Isn’t it easier? And most importantly, we use something that has already been well written once.

Summary

Although I have come across a lot of interesting approaches to working with themes in our Drupal agency, it must be emphasized that many things come with experience. Especially novice developers should follow Drupal’s philosophy from the very beginning. They should understand why they are doing something in a certain way. This allows us to see Drupal’s capabilities more easily and learn to use them to increase the comfort and efficiency of work, without losing the cleanliness of the code.

 

11 lectures worth seeing at DrupalCamp London 2019

DrupalCamp London 2019 is approaching fast. Are you ready for another great time with Drupal? This year, 42 sessions on Drupal and related topics are scheduled. This is a really tasty bit for any Drupal developer who can come. We hope, that with our help, you will choose the most promising lectures. Below are a few sessions you should definitely visit. We’ve picked topics both for experienced coders and beginners, as well as something for business owners, editors, marketers and others. 

1. Visual regression testing  

https://drupalcamp.london/session/visual-regression-testing-patterns

This talk will cover:

  • BackstopJS for visual regression testing on Pattern Lab patterns on a Drupal 8 theme. 
  • How to set up regression testing for each pattern and for the entire pattern library and the problems you could run into when setting up regression testing for patterns. 
  • The benefits of using this approach.

To take a part in this session, it’s best to have basic knowledge of how the integration of Drupal and Pattern Lab works. 

2. No Monkey Business Static Progressive Web Apps

https://drupalcamp.london/session/no-monkey-business-static-progressive-web-apps

This talk will cover:

  • An overview of the architecture used to deliver ii.co.uk.
  • How the GatsbyJS was used to generate static content from Drupal and other dynamic sources.
  • How these pages were further hydrated with React for dynamic content after the initial page load.
  • The custom cache handling implemented to keep content build pipelines.
  • Division of the responsibilities for content generation between GatsbyJS and Drupal.
  • Resolving the real-time preview issue without waiting for Gatsby’s upcoming hosted paid preview service.

3. Layouts in Drupal: past, present and future

https://drupalcamp.london/session/layouts-drupal-past-present-and-future

This talk will cover:

  • The history of building layouts in Drupal. 
  • Using Node reference (CCK), Nodequeue and custom template to build newspaper and magazine style layouts in Drupal 5. 
  • Having a look at “page builders” like Panels, Context and Block Visibility Groups. 
  • Dividing into CSS Grid layouts and using plugins like Masonry and GridStack for more advanced grid style layouts. 
  • Alternative approaches like Paragraphs, ECK/IEF and Bricks to create custom layouts. 
  • The pros and cons of these layout approaches and if and why they are now outdated.
  • New Layout Builder and some possible new approaches for building layouts in Drupal.

4. Creating an enterprise level editorial experience for Drupal 8 using React

https://drupalcamp.london/session/creating-enterprise-level-editorial-experience-drupal-8-using-react

This talk will cover:

  • Recent project results where a decoupled application with React was created, allowing the edition of content directly in the frontend. Using the possibilities of React to the fullest. 
  • Sharing an editorial experience with ‘in-place’ editing, ‘context-sensitive’ editing, ‘drag-n-drop’ content placement and creation, and much more.
  • Presentation of the application and vision of what an enterprise level editorial experience should look like.
  • What to expect when going fully decoupled with editorial experience and how this approach fits into the development of Drupal.

5. Migrate to Drupal

https://drupalcamp.london/session/migrate-drupal

The talk will cover:

  • Migrations in Drupal 7 and Drupal 8
  • Effective communication to project stakeholders
  • Writing and running efficient migrations

To take a part in this session, it’s best to have basic PHP coding skills and understanding of Drupal site building.

6. Droopler distribution – How can you save even 100 man-days during the development of a new website with Drupal

https://drupalcamp.london/session/droopler-distribution-how-can-you-save-even-100-man-days-during-development-new-website

Maciej Lukianski will show you that you don’t have to possess a budget of over ten thousand dollars if you need Drupal 8.

This talk will cover:

  • Droopler modules.
  • What paragraphs Droopler can offer to build your new page fast.
  • How simple it is to build a new landing page with Droopler in a live demo.
  • What ideas we have for the future functionalities of Droopler.

7. Drupal 8 SEO

https://drupalcamp.london/session/drupal-8-seo

This talk will cover:

  • Drupal modules, Google tools and external tools and how to use them to prepare an SEO strategy.
  • How to plan an SEO strategy for your website and how to compare your website with the competition.

8. Out of the Box Initiative Update

https://drupalcamp.london/session/out-box-initiative-update

This talk will cover:

  • The project in the past and present state of the initiative.
  • Targets for inclusion in Drupal 8.7.0
  • Ways to contribute to the project.
  • Plans for the more distant future.

9. Scrum everywhere – how we implemented Scrum not only in software development projects

https://drupalcamp.london/session/scrum-everywhere-how-we-implemented-scrum-not-only-software-development-projects

This talk will cover:

  • Using Scrum in the marketing team.
  • Using Scrum in QA team to improve software testing in the whole company.
  • Using Scrum for company management.
  • Using Scrum for the training of junior developers.

10. Accessibility in UX Design: How we redesigned The University of West London’s website for everyone

https://drupalcamp.london/session/accessibility-ux-design-how-we-redesigned-university-west-londons-website-everyone

This talk will cover:

  • Importance of accessibility in design, showcasing examples from industry giants such as Microsoft.
  • Highlights of accessible design.

11. How to start contributing to Drupal without code

https://drupalcamp.london/session/how-start-contributing-drupal-without-code

This talk will cover:

  • Non-code contributions and impactful ways to get involved in the Drupal project.
  • How to get started.

Summary

The talks presented by us are just a small part of what you will learn during DrupalCamp London 2019. Undoubtedly, the selection of the most important presentations out of 42 proposals is a real challenge. Perhaps the above list will help you choose. Certainly, the level of the conference will be as always deliberately high. Therefore, surely everyone will leave London with a huge dose of knowledge of Drupal innovations.

12 oz. Glass Status Jar

Our 12 oz. Status Jar is a great option if you are looking to add a slightly more modern or contemporary candle to your line. We recommend only filling this container with 8.9 oz of wax to make wicking a bit easier. We also offer a 21 oz. Status Jar.

Looking for a lid?
The 12 oz. Status Jar works with the following lids:

  • 3.25″ Bamboo Lid
  • Large Flat Top
  • Bronze Metal Flat Lid
  • Silver Metal Flat Lid
  • Black Metal Flat Lid
  • Matte Black Metal Flat Lid
  • Gold Metal Flat Lid
  • Rose Gold Metal Flat Lid
  • White Glass Tumbler Lid
  • Amber Glass Tumbler Lid
  • Black Glass Tumbler Lid

How much wax will it hold? 
See this information in the Properties section of this page. Learn more about container wax weight and volume.

Looking for a wick suggestion?
Check out our wick guide to see recommendations! Our recommendations are estimates and should be used as a starting point for your own burn testing.

Looking for labels?
Put the finishing touch on your candles with the perfect product label from Avery WePrint. Browse designs, create your own, and take 10% off all label orders!

  • Already have an idea of what you’d like to do? Head to avery.com to get started.
  • Not sure what label size or shape to use? Check out Avery’s Label Sizes Chart.
  • Looking for labeling tips or want to see the latest in design trends? Explore Avery’s Candle Label Inspiration & Ideas for your candle line.

Need shipping boxes?
Flush Packaging offers durable shipping boxes custom fit to a wide variety of CandleScience vessels—ensuring your finished candles get delivered safely.

Wholesale Ordering
Check out our wholesale page for more information on ordering candle supplies in bulk or by the pallet.

Imported

Container Properties

Material GlassTransparency TransparentWax Weight (to Fill Line) 8.90 oz (252.31 g)Volume (to Overflow) 11.80 fl oz (335.27 mL)Height 4.00" (10.16 cm)Top Inside Diameter 2.94" (7.47 cm)Top Outside Diameter 3.03" (7.70 cm)Label Format RectangularLabel Placement SideLabel Width 9.88" (25.10 cm)Label Height 3.25" (8.26 cm)Prop 65 Warning No

Community Inspiration

BlueHost WordPress主机双十一特惠销售

BlueHost是WordPress官网都在推荐的WordPress主机商,本次国内双十一优惠大促销,BlueHost推出一系列优惠活动,此时购买BlueHost WordPress主机性价比非常高,朋友们千万不要错过这次机会。

BlueHost双十一特惠销售详情:(活动时间:2020.11.11-2020.11.13)只有三天!只有三天!一定速抢!

全场BlueHost虚拟主机/云虚拟主机最高3折优惠

专属优惠码:11.11

官网活动通道:官网通道

所有BlueHost虚拟主机/云虚拟主机方案,一年期方案可享受七折折优惠,两年期方案可享受六折优惠,三年期方案可以享受五折优惠,五年期方案可以享受四折优惠,十年期方案可以享受三折优惠。

美国/香港主机不计量流量,不计量存储空间,免费全球CDN加速,赠送.com域名及云备份服务,电信CN2直连,买的越多,优惠越多,折扣更给力。

温馨提示:本次BlueHost WordPress主机双十一特惠活动,只有三天,有需要的朋友一定要尽快入手,错过就要再等一年了。

分类:新闻资讯

标签:BlueHost, WordPress主机, 最新动态

Purchase as a gift but worried about going past the return period?

This elevated pet sofa bed combines style and functionality to create a cozy retreat for your furry friend. Crafted with waterproof material and a supportive backrest, it guarantees both comfort and durability for any living space.

  • Premium Waterproof Material: Designed with high-quality waterproof leather, ensuring easy cleaning and lasting durability.
  • Ergonomic High Backrest: Provides essential support and comfort for your pet’s spine during rest.
  • Stylish Modern Aesthetic: Complements contemporary interiors with its sleek and minimalist design.
  • Portable and Lightweight: Equipped with handles for effortless transportation and storage.
  • Non-Slip Base Stability: Ensures the bed stays securely in place even during playful moments.

Main Material: 
Polyester, Polypropylene Cotton
Products Sizes:
S: 20.87″L x 15.75″W x 7.87″H (53x40x20cm)
M: 25.59″L x 19.69″W x 9.45″H (65x50x24cm)
L: 31.50″L x 23.62″W x 11.02″H (80x60x28cm)

Keyword: