简体   繁体   English

Drupal以其他内容的形式添加内容

[英]Drupal add content in another content's form

I'm using Drupal 7 and I'm currently facing the following problem: 我正在使用Drupal 7,目前正面临以下问题:

I have a database that among other data consists of addresses and services . 我有一个数据库,其中的其他数据包括地址服务 The relationship is such that every service needs to have an address (just one). 这种关系使得每个服务都需要有一个地址 (只有一个)。 In Drupal both addresses and services are content types and a service has a field that relates it to an address (using EntityReference module). 在Drupal中, 地址服务都是内容类型,并且服务具有将其与地址相关联的字段(使用EntityReference模块)。

When creating a new service users can choose an existing address for it, but the address needs to be created beforehand. 创建新服务时,用户可以为其选择一个现有地址 ,但是该地址需要事先创建。 I would like to know of it's possible to create a content creation form for service that would contain all the fields for address as well. 我想知道有可能为服务创建一个内容创建表单,该表单还将包含地址的所有字段。 If the user would fill all the fields by hand, a new service and a new address would be created. 如果用户手动填写所有字段,则会创建新服务和新地址 There should also be an option to choose an address (from a list or suggestion box). 还应该有一个选择地址的选项(从列表或建议框中)。 Upon doing so the address fields would be automatically populated with data from an already existing address and, when submitted, the form would result in creation of a new service related to a previously existing address (just like it works now). 这样做后,地址字段将自动使用来自现有地址的数据填充,并且在提交时,该表单将导致创建与先前地址相关的新服务 (就像现在一样工作)。 I did a very similar thing in Django and it was very easy and didn't require a very application-specific code. 我在Django中做过非常类似的事情,它非常简单,不需要非常特定于应用程序的代码。 I was wondering if there is a just as simple way to do it in Drupal. 我想知道在Drupal中是否有同样简单的方法可以做到这一点。

To put it shortly - I'm looking for a service content creation form that gives the choice choice between choosing an existing address or creating a new one "in-place" (ie in the same form). 简而言之-我正在寻找一种服务内容创建表单,该表单可以在选择现有地址或创建一个新的“就地”地址(即,以相同的形式)之间做出选择。

I would also like to add that I'm relatively new to Drupal (although I have php experience) and it's difficult for me to properly name the problem I'm facing. 我还想补充一点,我是Drupal的新手(尽管我有php经验),而且我很难正确地指出我所面临的问题。 As a result it's quite possible that the title of this question is not relevant and/or this issue has been addressed in another question (and yes, I searched for it). 结果,很可能这个问题的标题不相关和/或这个问题已经在另一个问题中解决了(是的,我已经搜索了)。 If that is the case, feel free to just point me in the right direction. 如果是这种情况,请随时指出正确的方向。

Any help would be greatly appreciated. 任何帮助将不胜感激。

Thanks! 谢谢!

The references dialog module should be just what you need! 引用对话框模块应该正是您所需要的! It should allow you to add a referenced node without leaving your current edit screen! 它应该允许您添加引用的节点而不离开当前的编辑屏幕!

It doesn't place the fields right in there, but you don't have to leave the screen to create a referenced node. 它不会将字段直接放在其中,但是您不必离开屏幕即可创建引用的节点。

Is this what you had in mind? 这就是您的想法吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM