如何在 Drupal 中导入视图?

发布于 2024-12-18 06:48:37 字数 151 浏览 2 评论 0原文

如何将视图导入 Drupal。我有一个导出的视图,需要在不同的 Drupal 安装中导入。我在管理/结构/视图中没有导入选项?

谢谢!

编辑:

我找到了解决方案。我必须以用户 1 身份登录才能获得此选项。

How I can Import a view to Drupal. I have an exported view that I need to import in a different Drupal Installation. I don't have an import option in the admin/structure/views?

Thanks!

Edit:

I have found the solution. I have to log in as user 1 to get this option.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

五里雾 2024-12-25 06:48:37

视图列表页面中有一个导入选项。只需将此网址粘贴到当前网址之后,您就会看到导入视图页面。通过查看您的标签,我假设您正在使用 Drupal 7,因此下面给出的 url 仅适用于 Drupal 7。

以下是要添加的 url:

#overlay=admin/structure/views/import

There is a import option in the views listing page. Just paste this url after your current url and you will see the import views page. By seeing your tags I am assuming you are using Drupal 7, so the given below url will work only for Drupal 7.

Below is the url to be added :

#overlay=admin/structure/views/import
始于初秋 2024-12-25 06:48:37

对于D7,如果您不想使用用户#1,可以启用“PHP过滤器”核心模块,然后授予相关用户角色“使用PHP进行设置”权限。然后,具有此角色的用户将在视图管理页面上的“添加新视图”链接旁边看到一个“导入”链接。或者您可以直接进入/admin/struct/views/import 导入页面

For D7, if you don't want to use user #1, you can enable the 'PHP filter' core module, and then give the relevant user role the 'Use PHP for settings' permission. Users with this role will then see an 'import' link next to the 'Add new view' link on the views admin page. Or you can go to the import page directly on /admin/structure/views/import

我ぃ本無心為│何有愛 2024-12-25 06:48:37

我刚刚发现了发生这种情况的另一个原因 - Paranoia 模块被启用。如果启用,/admin/struct/views/import 将显示“您无权访问此页面”,即使您以 UID1 身份登录

酷模块。如果启用,您将不会在管理界面中看到它,即使您以 UID1 身份登录。您需要使用 drush dis paranoia 禁用它或在系统表中将其状态设置为 0。

I have just discovered another reason this can happen - the Paranoia module being enabled. If enabled, /admin/structure/views/import will display "You are not authorized to access this page", even if you are logged in as UID1.

Cool module. If it's enabled, you won't see it in the admin interface, even if you're logged in as UID1. You'll need to disable it with drush dis paranoia or setting the status of it to 0 in the system table.

一城柳絮吹成雪 2024-12-25 06:48:37

对于 Drupal 6,您将使用:

/admin/build/views/import

For Drupal 6 you would use:

/admin/build/views/import

匿名。 2024-12-25 06:48:37

当您将所有权限检查设置为 true 时,用户 1 即可工作。

要为其他用户启用此功能,您需要启用 php 模块并确保您的用户具有“使用 PHP 进行设置”,这是一个仅应提供给受信任用户的设置,因为它允许在您的计算机上执行几乎任何操作。地点。这就是导入视图时发生的情况。有关详细信息,请参阅此帖子

User 1 works as you have all permissions checks set to true.

To enable this for other users you need to enable the php module and make sure your user has the "use PHP for settings", this is a setting that should only be given to trusted users as it allows pretty much anything to be done on your site. Which is what happens when importing a view. For more info see this thread.

梦里人 2024-12-25 06:48:37

任何喜欢运行锁定站点的人都可能选择禁用用户 1(避免密码被猜到的风险)并禁用 PHP 模块(例如站点策略是避免使用 PHP 输入过滤器)。

如果您愿意在自定义模块中编写 php 挂钩,则可以执行以下操作(取自 php.module):

/**
 * Implements hook_permission().
 */
function XXX_permission() {
  if (!module_exists('php')) {
    return array(
      'use PHP for settings' => array(
        'title' => t('Use PHP for settings'),
        'restrict access' => TRUE,
      ),
    );
  }
}

return $permissions;
}

Anyone who prefers to run a locked down site may have chosen to disable user 1 (avoid risk that the password is guessed) and disable the PHP module (for example site policy is to avoid using PHP input filter).

If you are comfortable writing a php hook in your custom module, you can do this (taken from php.module):

/**
 * Implements hook_permission().
 */
function XXX_permission() {
  if (!module_exists('php')) {
    return array(
      'use PHP for settings' => array(
        'title' => t('Use PHP for settings'),
        'restrict access' => TRUE,
      ),
    );
  }
}

return $permissions;
}

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文