标签: drupal-8

禁用整个缓存以进行开发

我正在为Drupal 8开发一个新主题.我需要禁用Drupal中的所有缓存机制.我找到了twig缓存和CSS/JavaScript的配置,但没有找到Drupal的其他东西(比如.theme文件等).

我在这里找到了一些提示:

在第一个链接中,您会发现一些条目cache.以及在第二个链接中开始,如何停用后端缓存?

虽然如果我粘贴这两行:

$settings['container_yamls'][] = DRUPAL_ROOT . '/sites/development.services.yml';
$settings['cache']['bins']['render'] = 'cache.backend.null';
Run Code Online (Sandbox Code Playgroud)

进入我的settings.phpDrupal会显示一条消息,指出页面出错.

drupal drupal-8

5
推荐指数
1
解决办法
2709
查看次数

如何在Drupal 8模板中从uri获取图像URL

我正在尝试创建自己的图像字段格式化程序.我已按照这些说明(http://www.sitepoint.com/creating-custom-field-formatters-drupal-8/),现在我有一个工作格式化程序,除了"继承"并执行默认图像基本上什么都不做格式化.

然后我当然有自己的模板,它也是默认的image-formatter.html.twig模板的副本(在core\modules\image\templates中找到).

现在我的问题是,在模板中,我可以使用Twig语法{{image}}打印整个图像.如果我使用dump(图像),我看到实际上图像是这样的:public:// default_images/Drupal Ant的默认图像task.jpg

我很想拥有实际的网址,但现在我不知道如何获得它.它甚至可能吗?如果您能及时解释为什么{{image}}使用img标签打印图像,我也将不胜感激?它必须通过另一个格式化程序?

为什么我开始这样做是因为我不想使用img标签而是使用具有背景图像风格的div.

drupal twig drupal-8

5
推荐指数
1
解决办法
7556
查看次数

Drupal 8,以编程方式获取自定义内容的字段列表

我想以编程方式创建自定义内容(通过管理UI创建的自定义内容).但是,在创建之前,我想以编程方式检查自定义内容的字段类型

我的自定义内容包含字段"body"(类型文本),字段"description"(类型文本),int字段(类型int),附加文件字段(类型fid?)...

我用Drupal 8的新api测试了几种方法,我的最后一次尝试..

// I get the entity object "my_custom_content"
$entity_object = NodeType::load("my_custom_content");
dpm($entity_object); //Work perfectly


$test = \Drupal::getContainer()->get("entity_field.manager")->getFieldDefinitions("my_custom_content",$entity_object->bundle())
//The \Drupal::getConta... Return an error : The "my_custom_content" entity type does not exist.
Run Code Online (Sandbox Code Playgroud)

使用此$ entity_object,如何获取自定义内容的字段列表?我看到了EntityFieldManager类,FieldItemList类......但我仍然不明白如何玩drupal 8/class/poo ...:/

谢谢 !

drupal-8 drupal-fields drupal-nodes

5
推荐指数
1
解决办法
1万
查看次数

Drupal安装:在PHP配置中设置xdebug.max_nesting_level = 256

我在这里按照教程 https://www.youtube.com/watch?v=h5i6emqdOgg

在安装之间我得到这个页面,它显示缺少一些要求.其中一人说Set xdebug.max_nesting_level=256 in your PHP configuration

我去了哪家C:\wamp\www\sampleWebSite\sites\default:

  1. default.services.yml
  2. default.settings.php
  3. 的settings.php

我打开settings.php看看xdebug设置,但那里丢失了.所以,我添加了一行有xdebug.max_nesting_level=256再刷新页面和页面给了我的错误,让我去同settings.php一次文件,并改变了它$settings['xdebug.max_nesting_level'] = 256;没有错误,但现在页面仍然显示xdebug设置没有被设置为256.

怎么解决?

在此输入图像描述

php installation drupal drupal-8

5
推荐指数
1
解决办法
1万
查看次数

Aegir drupal 8兼容吗?

我没有就此问题找到明确的答案.Aegir(目前的3.3版本)可以与drupal 8网站一起使用吗?

drupal drupal-8 aegir

5
推荐指数
1
解决办法
1302
查看次数

更新模块和核心ERROR文件名,目录名或卷标签语法不正确

我看过类似的问题,但找不到答案。

内容:Windows 10,XAMPP,Git,Composer,Drush 8和Drupal 8。

当我尝试使用时:

(对于模块和主题更新)drush pm-update

要么

(用于核心更新)加快Drupal

我收到以下错误:

Illegal string offset 'site' backend.inc:1037                        [warning]
The command could not be executed successfully (returned: The        [error]
filename, directory name, or volume label syntax is incorrect.
, code: 1)
pm-updatestatus failed.   
Run Code Online (Sandbox Code Playgroud)

但是我没有问题,例如使用Drush进行下载,启用,重建缓存等。

我也可以通过Drupal(extend> update)更新模块。

我尝试过

drush pm-update --debug --verbose

这是一个警告和两个错误的摘要。

Backend invoke:                                                        [command]
"C:\\Users\\Usuario\\AppData\\Roaming\\Composer\\vendor\\drush\\drush\\drush"
 --backend=2 --verbose --debug --root="C:\\xampp\\htdocs\\mysite"
--uri=http://default  pm-updatestatus 2>&1 [4.59 sec, 14.67 MB]
"C:\\Users\\Usuario\\AppData\\Roaming\\Composer\\vendor\\drush\\drush\\drush"   [notice]
 --backend=2 --verbose --debug --root="C:\\xampp\\htdocs\\mysite"
--uri=http://default  pm-updatestatus 2>&1 [4.59 …
Run Code Online (Sandbox Code Playgroud)

xampp drupal drush git-bash drupal-8

5
推荐指数
0
解决办法
569
查看次数

在drupal 8中添加元标记

我是drupal 8的新手,想在我的drupal 8网站上添加meta标签.

我这样做了:

  1. 在我的THEME.theme文件中添加了以下代码

    /**
     * Implements hook_page_attachments_alter().
     *
     * Include meta tags and fonts using attachment method.
     */
    function bartik_page_attachments_alter(array &$page) {
     // echo "<pre>"; echo "BEFORE"; print_r($page);
      // Include fonts.
      $font_attributes = array(
        'rel' => 'stylesheet',
        'type' => 'text/css',
        'href' => 'https://fonts.googleapis.com/css?family=Lato:400,100,100italic,300,300italic,400italic,700',
      );
    
      $page['#attached']['html_head_link'][] = array($font_attributes);
    
      // Set up meta tags.
      // Modern IE & chrome-frame rendering engine tag.
      $rendering_meta = array(
        '#type' => 'html_tag',
        '#tag' => 'meta',
        '#attributes' => array(
          'name' => 'SKYPE_TOOLBAR',
          'content' => 'SKYPE_TOOLBAR_PARSER_COMPATIBLE', …
    Run Code Online (Sandbox Code Playgroud)

drupal-8

5
推荐指数
3
解决办法
1万
查看次数

如何在Drupal 8中以编程方式清除缓存

我正在研究Drupal 8网站.这个网站正在运作.我最近搬到了另一台机器上.它显示的错误如下:

Recoverable fatal error: Argument 1 passed to 

Drupal\Component\DependencyInjection\Container::__construct() must be of

 the type array, boolean given, called in [DRUPAL-

PATH]/core/lib/Drupal/Core/DrupalKernel.php on line 883 and defined in 

[DRUPAL-PATH]/core/lib/Drupal/Component/DependencyInjection/Container.php

 on line 119 #0 [DRUPAL-PATH]/core/includes/bootstrap.inc(550): 

_drupal_error_handler_real(4096, 'Argument 1 pass...', 

'/Applications/M...', 119, Array)
Run Code Online (Sandbox Code Playgroud)

我需要以编程方式清除缓存.

但是,我找不到任何帮助.

有些专家可以帮帮我吗?

caching drupal drupal-8

5
推荐指数
3
解决办法
8047
查看次数

CKEditor:PasteFromWord忽略pasteFilter

在CKEditor 4.6.2(目前捆绑在Drupal 8中)默认情况下禁用ACF,以确保某些特殊插件正常工作.所以为了记录:我不想启用ACF,也不能使用allowedContentdisallowedContent.我试图阻止一些元素从Word上注入(像h1p[styles]).

为了实现这一点,我试图将这些添加到pasteFilter非Word粘贴内容上,但是当从Word粘贴时pasteFilter似乎被忽略了?这是一个错误吗?

那么,我怎么能:

  1. 保持ACF禁用 - 支持特殊的Drupal元素
  2. 保持pastefromword启用状态 - 检测缩进和列表等特殊的Word样式.
  3. 添加额外的过滤,所有(包括从Word)pastings -要删除一些元素和属性,如h1,style="font-family: Verdana"等...

javascript ckeditor drupal-8

5
推荐指数
1
解决办法
439
查看次数

表中的响应图像

图像应在表格单元格中具有响应性,并且背景色应填充所有空白区域。

我正在Drupal网站(版本8.6.7)上工作,该网站将使数字符号显示在表行中。我正在使用Drupal8 Zymphonies主题8.x-1.3,我希望它能在从笔记本电脑到手机的设备上运行。我还希望图像填充尽可能多的单元格,而背景色将填充其余部分。我在自定义文本字段的视图中生成此代码。我正在尝试使用放置在td-tag中的CSS类,但是它不起作用。-在小型设备中,图像会变得很小,并且不会填满td单元。-背景颜色不能完全覆盖图像。-空单元格在中间出现一个白色正方形。

In CSS-file I have this:
 .uptoten {
    background-color:yellow;
    padding: 0px; 
    margin: 0px;
}   
Run Code Online (Sandbox Code Playgroud)

在自定义文本字段中,我在td-tag中使用此类:class ='uptoten'

在结果上附加了图像。在笔记本电脑上:

在笔记本电脑上的结果 我希望白色的内部正方形消失,并且图像填充单元格。

在小型设备上,图像太小:

电话结果

输入的Twig:

{%set img_txt = random(['anka', 'groda', 'tomte', 'drake'])%}
{%set img_file = '/sites/default/files/num-images/'~img_txt~'.jpg'%}
{%set img_blanc = '/sites/default/files/num-images/empty.jpg'%}
{%set max=nothing|trim%}
{%set blanc=20-max%}
<table >
  <tr>
{% for i in 1..20 %}
{% if i<11 %}
<td class='uptoten'>
{% else%}
<td>
{% endif %}

{% if i<=max %}
    <img alt={{img_txt}} src={{img_file}} />

    {%else%}
    <img alt="empty" src={{img_blanc}} />
{% endif %}
</td>
{% …
Run Code Online (Sandbox Code Playgroud)

css html5 drupal-8

5
推荐指数
1
解决办法
126
查看次数