标签: drupal-8

禁用损坏的Drupal 8模块

似乎无法设法禁用损坏的D8模块,我现在正在遭受WSOD的困扰,而且似乎无法解决
这个问题.我越来越

PHP error
Uncaught PHP Exception ReflectionException: "Class \Drupal\restui\Controller\RestUIController 
does not exist" at /mnt/www/html/xxxxx/docroot/core/lib/Drupal/Core/Entity/EntityResolverManager.php 
line 132 request_id="v-210c8b9e-9aaa-11e4-9d97-22000a1f8652"
Run Code Online (Sandbox Code Playgroud)

在我的Acquia Cloud日志中,我真的只是想把它从那里拿出来,但没有骰子.通过修改活动服务yml来删除模块有一个hack,但它没有在本地repo中列出.

这似乎是一个更大问题的一部分 - https://www.drupal.org/node/2225029

但答案很少.有人必须知道,对吧?

drupal acquia drupal-8 drupal-modules

2
推荐指数
1
解决办法
5692
查看次数

如何在Drupal 8中更改首页的标题?

也许,这很容易,但我不知道如何改变Drupal 8中头版的标题.有人可以帮帮我吗?

drupal-8

2
推荐指数
1
解决办法
4237
查看次数

Drupal 8,“托管文件”字段的默认值

我通过自定义模块创建了一个编辑自定义表单(节点的)。在这个表单中,我有一个“管理文件”字段(对于一张图片),我将他的默认值设置为 fid;但是,当我的表单呈现时,“托管文件”字段不显示图像。我不明白为什么:/

我的代码:

$form['project']['image'] = array(
  '#type' => 'managed_file',
  '#title' => t('Image'),
  '#default_value' => 10, //Set 10 for the test, the fid "10" exist, I checked
);
Run Code Online (Sandbox Code Playgroud)

我的表格呈现:

[在此处输入图片说明]

如您所见,没有加载图像,而 default_value 设置为现有的 fid (10)

1

drupal-forms drupal-8

2
推荐指数
1
解决办法
3062
查看次数

如何防止 Drupal 关注触发 ajax 提交的元素?

当我使用 ajax 提交表单时,触发提交的元素会获得焦点。如果我使用无限滚动并且希望将用户保留在页面底部,我不希望出现这种行为。我该如何解决?

焦点返回到这个元素:

     $form['submit'] = [
        '#type' => 'submit',
        '#value' => $this->t('Search'),
        '#attributes' => [
            'class' => [
                'btn',
                'btn-md',
                'btn-primary',
                'use-ajax-submit'
            ]
        ],
        '#ajax' => [
            'wrapper' => $wrapper,
        ]
    ];
Run Code Online (Sandbox Code Playgroud)

forms ajax jquery focus drupal-8

2
推荐指数
1
解决办法
1519
查看次数

使用 Swiftmailer 的自定义 Drupal 8 模块忽略树枝模板

我已经构建了一个非常简单的模块来学习如何集成 swiftmailer 模块来发送使用自定义树枝模板的电子邮件。

位于此处的默认 swiftmailer twig 模板的副本:http ://cgit.drupalcode.org/swiftmailer/tree/templates/swiftmailer.html.twig 根据文件本身中包含的说明进行了轻微修改和重命名:

 * This template may be overriden by module and/or mail key, using any of the
 * following template names:
 * - swiftmailer.html.twig: global, used by default.
 * - swiftmailer--mymodule.html.twig: only emails sent by the module "mymodule".
 * - swiftmailer--mymodule--test.html.twig: only emails by the module
 *   "mymodule" with key "test".
 *
Run Code Online (Sandbox Code Playgroud)

twig文件的名称是swiftmailer--emailtester.html.twig,它位于活动的 themes/mytheme/templates 文件夹中。

当我在emailtester.module 中执行发送电子邮件的调用并遍历 Core 中的 ThemeManager.php、twig.engine.php 和 Render.php 文件中的调用时,模板路径指向/modules /contrib/swiftmailer/templates/swiftmailer.html.twig文件,而不是/themes/mytheme/templates/swiftmailer--emailtester.html.twig …

swiftmailer twig drupal-8

2
推荐指数
1
解决办法
2446
查看次数

Drupal 8自定义表单,带弹出窗口

当用户点击前端的链接时,我想在弹出窗口中显示我的自定义表单,我尝试了很多在网络上显示的解决方案,但对我不起作用.

这是我的代码.

        $response = new AjaxResponse();
        // Get the modal form using the form builder.
        $modal_form = $this->formBuilder->getForm('Drupal\fwsactions\Forms\FwsActionsForm');
        $modal_form['#attached']['library'][] = 'core/drupal.dialog.ajax';
        // Add an AJAX command to open a modal dialog with the form as the content.
        $modal_form = render($modal_form);
        $response->addCommand(new OpenModalDialogCommand('My Modal Form', $modal_form, ['width' => '800']));

        return $response;
Run Code Online (Sandbox Code Playgroud)

如何通过单击链接打开此表单应该怎么做.

drupal drupal-8 drupal-modules

2
推荐指数
1
解决办法
2512
查看次数

Drupal 8 问题:InvalidArgumentException:URI '' 无效

我正在努力解决这个问题:

InvalidArgumentException: The URI '' is invalid.
You must use a valid URI scheme. in Drupal\Core\Url::fromUri() 
(line 284 of core/lib/Drupal/Core/Url.php).
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?

url url-routing drupal-8

2
推荐指数
2
解决办法
6579
查看次数

无法通过 Drupal 8 中的 Composer 更新 dompdf

我们正在尝试让所有未使用 Composer 安装的 Drupal 模块在 Composer 中进行管理。

  • 作曲家:1.4.12
  • Drupal:8.3.1

清除 Composer 的缓存后,我们运行以下命令:

./composer require dompdf/dompdf;
Run Code Online (Sandbox Code Playgroud)

这将返回:

./composer.json has been updated
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Can only install one of: phenx/php-svg-lib[v0.2, 0.1].
    - Can only install one of: phenx/php-svg-lib[v0.2, 0.1].
    - Can only install one of: phenx/php-svg-lib[v0.2, 0.1].
    - dompdf/dompdf v0.8.0 requires phenx/php-svg-lib 0.2.* -> satisfiable by phenx/php-svg-lib[v0.2]. …
Run Code Online (Sandbox Code Playgroud)

drupal dompdf drupal-8 composer-php

2
推荐指数
1
解决办法
754
查看次数

Twig_Error_Loader:未定义模板-Drupal

include在Drupal中创建了一个:

{% include directory ~ '/partials/header.html.twig' %}

但我收到此错误:

Twig_Error_Loader: Template "themes/custom/mytheme/partials/header.html.twig" is not defined (Drupal\Core\Template\Loader\ThemeRegistryLoader: Unable to find template "themes/custom/mytheme/partials/header.html.twig" in the Drupal theme registry.) in "themes/custom/mytheme/page--front.html.twig" at line 1. in Twig_Loader_Chain->getCacheKey() (line 115 of vendor/twig/twig/lib/Twig/Loader/Chain.php).

根据Drupal和Twig文档,我正在以正确的方式进行操作。

我有一个目录partials,一个文件header.html.twig

在此处输入图片说明

我究竟做错了什么?我在El Capitan的MAMP和OSX中运行Drupal。Drupal 8.3.7

php drupal twig drupal-8

2
推荐指数
1
解决办法
5329
查看次数

2
推荐指数
1
解决办法
2167
查看次数