尝试将社交媒体链接添加到 Drupal 网站
Trying to add social media links to Drupal website
我正在尝试将社交媒体图标添加到我的 drupal 网站并按照 this guide 尝试安装它们。该模块似乎安装正常,但是当我尝试将其配置为在单击“保存”时添加不同的链接时,它会将我带到一个网页,上面只写着 The website encountered an unexpected error. Please try again later.
我试过 uninstalling/reinstalling 这个插件,但似乎没有任何作用。我的设置中是否缺少某些权限?我几乎是 drupal 的新手
编辑:错误的 url 是 admin/structure/block/manage/socialmedialinks?destination=/node
和一些错误日志:
TypeError: Argument 2 passed to Egulias\EmailValidator\EmailValidator::isValid() must implement interface Egulias\EmailValidator\Validation\EmailValidation, bool given,
social_media_links drupal 模块版本 8.x-2.6 在检查电子邮件地址的有效性时似乎存在错误。
模块的问题队列中存在问题 HERE。
该问题附有补丁(附在下方):
diff --git a/src/Plugin/SocialMediaLinks/Platform/Email.php b/src/Plugin/SocialMediaLinks/Platform/Email.php
index 007e59f..2926d47 100755
--- a/src/Plugin/SocialMediaLinks/Platform/Email.php
+++ b/src/Plugin/SocialMediaLinks/Platform/Email.php
@@ -4,7 +4,6 @@ namespace Drupal\social_media_links\Plugin\SocialMediaLinks\Platform;
use Drupal\social_media_links\PlatformBase;
use Drupal\Core\Form\FormStateInterface;
-use Egulias\EmailValidator\EmailValidator;
use Drupal\Core\Url;
/**
@@ -29,9 +28,9 @@ class Email extends PlatformBase {
*/
public static function validateValue(array &$element, FormStateInterface $form_state, array $form) {
if (!empty($element['#value'])) {
- $validator = new EmailValidator();
+ $validator = \Drupal::service('email.validator');
- if (!$validator->isValid($element['#value'], TRUE)) {
+ if (!$validator->isValid($element['#value'])) {
$form_state->setError($element, t('The entered email address is not valid.'));
}
}
我正在尝试将社交媒体图标添加到我的 drupal 网站并按照 this guide 尝试安装它们。该模块似乎安装正常,但是当我尝试将其配置为在单击“保存”时添加不同的链接时,它会将我带到一个网页,上面只写着 The website encountered an unexpected error. Please try again later.
我试过 uninstalling/reinstalling 这个插件,但似乎没有任何作用。我的设置中是否缺少某些权限?我几乎是 drupal 的新手
编辑:错误的 url 是 admin/structure/block/manage/socialmedialinks?destination=/node
和一些错误日志:
TypeError: Argument 2 passed to Egulias\EmailValidator\EmailValidator::isValid() must implement interface Egulias\EmailValidator\Validation\EmailValidation, bool given,
social_media_links drupal 模块版本 8.x-2.6 在检查电子邮件地址的有效性时似乎存在错误。
模块的问题队列中存在问题 HERE。
该问题附有补丁(附在下方):
diff --git a/src/Plugin/SocialMediaLinks/Platform/Email.php b/src/Plugin/SocialMediaLinks/Platform/Email.php
index 007e59f..2926d47 100755
--- a/src/Plugin/SocialMediaLinks/Platform/Email.php
+++ b/src/Plugin/SocialMediaLinks/Platform/Email.php
@@ -4,7 +4,6 @@ namespace Drupal\social_media_links\Plugin\SocialMediaLinks\Platform;
use Drupal\social_media_links\PlatformBase;
use Drupal\Core\Form\FormStateInterface;
-use Egulias\EmailValidator\EmailValidator;
use Drupal\Core\Url;
/**
@@ -29,9 +28,9 @@ class Email extends PlatformBase {
*/
public static function validateValue(array &$element, FormStateInterface $form_state, array $form) {
if (!empty($element['#value'])) {
- $validator = new EmailValidator();
+ $validator = \Drupal::service('email.validator');
- if (!$validator->isValid($element['#value'], TRUE)) {
+ if (!$validator->isValid($element['#value'])) {
$form_state->setError($element, t('The entered email address is not valid.'));
}
}