我第一次使用一个优秀的模板来练习Drupal。在其中一个块中,我设法使用了kint,可以看到数组中的内容,如下所示:
{{ kint(content) }}但是,现在我创建了一个新文件(在核心主题下是原始文件的副本),并命名为node--article--full.html.twig
在该文件中,我尝试使用相同的代码
{{ kint(content) }}我清除了所有缓存并访问了这篇文章;但是当它加载时,出于某种原因,它会将我带到localhost/themename/core/install.php
完整的文件如下所示:
{%
set classes = [
'node',
'node--type-' ~ node.bundle|clean_class,
node.isPromoted() ? 'node--promoted',
node.isSticky() ? 'node--sticky',
not node.isPublished() ? 'node--unpublished',
view_mode ? 'node--view-mode-' ~ view_mode|clean_class,
]
%}
{{ attach_library('classy/node') }}
<article{{ attributes.addClass(classes) }}>
{{ title_prefix }}
{% if not page %}
<h2{{ title_attributes }}>
<a href="{{ url }}" rel="bookmark">{{ label }}</a>
</h2>
{% endif %}
{{ title_suffix }}
{% if display_submitted %}
<footer class="node__meta">
{{ author_picture }}
<div{{ author_attributes.addClass('node__submitted') }}>
{% trans %}Submitted by {{ author_name }} on {{ date }}{% endtrans %}
{{ metadata }}
</div>
</footer>
{% endif %}
<div{{ content_attributes.addClass('node__content') }}>
{{ content }}
</div>
{{ kint(content) }}
Hi there from the full node template of the aticle content type
</article>这个文件有什么问题吗?请注意,如果我删除kint内容,该文件将正常工作。
发布于 2019-05-14 21:34:11
由于kint会消耗大量资源,因此数据库资源耗尽的可能性很高。一个非常常见的修复方法是通过kint减少可访问级别的数量。
你可以找到更多信息here。希望这能有所帮助
发布于 2020-10-02 23:57:42
潜在的问题是,如果代码看不到数据库,它就会假定您必须安装Drupal。
https://stackoverflow.com/questions/55117888
复制相似问题