检查term是否存在并创建带有规则的节点
我实际上有 2 个关于 Drupal 7 和规则的问题。:
- 如何检查一个术语是否存在规则
- 如何创建一个新节点并使用规则转发到节点条目
让我先勾勒出场景,然后更详细地解释:
我目前创建一个与条形码扫描仪一起使用的简单库存程序。条形码存储在分类树中。我有 2 种内容类型:扫描件和产品。
用户始终会看到条形码扫描仪将填写并提交的扫描内容类型(一个大文本输入)。
然后,Drupal 检查扫描的条形码是否存在于分类中。
如果不是,它会为产品创建一个新节点,并让用户填写有关此条形码的所有详细信息。如果该术语确实存在,则仅保存扫描节点(其计数器 +1 或 -1),以便我稍后可以使用视图来查看有多少产品进入或退出。
我试图按照规则做到这一点......但没有成功。
所以我的第一个问题是:如何检查词汇表中是否已存在某个术语?我认为它需要用 php 规则中的 drupal 本机函数来完成,但找不到这个函数。我错过了什么吗?
我的第二个问题是关于规则实体。
我正在尝试创建一个带有规则的节点。当术语不存在时,规则需要创建一个新的产品节点并将其显示给用户,以便他们可以填写一些详细字段然后保存。
我正在尝试使用规则 -> 来做到这一点创建新实体。作为“实体类型”,我选择“节点”,作为“内容类型”,我选择我的产品内容类型。然后我还需要填写一个标题。哪里出了问题。我尝试将每种类型的数据或字符串放入“标题”的“值”字段中,并且“规则”接受它并保存规则。但是每次规则创建节点失败时都会出现以下错误消息:
Unable to create entity node": Invalid data value given. Be sure it matches the required data type and format.
如何有效地创建特定内容类型的新节点并将其呈现给用户以进一步完成,所有这些都带有规则?
我希望我能解释清楚:)
谢谢:)
I actually have 2 questions regarding Drupal 7 and Rules.:
- How to check if a term exists with rules
- How to make a new node and forward to the node entry with rules
Let me sketch the scenario first and then explain in more detail:
Im currently creating a simple stock program to be used with a barcode scanner. The barcodes are stored in a taxonomy tree. I have 2 content types, a scan and a product.
A user is always presented with the scan content type (one big text input) that the barcode scanner will fill in and submit.
Drupal then checks to see if the scanned barcode is present in the taxonomy.
If it is not it creates a new node for product and lets the user fill in all the details about this barcode. If the term does exist, only the scan node is saved (which has a counter +1 or -1) so that I can later use views to see how many products went in or out.
Im trying to do this with rules...without success.
So my first question is: How can I check if a term already exists in a vocabulary? I think it needs to be done with a drupal native function in a php rule, but cannot find this function. Am I missing something?
My second question is about Rules entities.
I'm trying to create a node with a rule. When a term does not exist, rules needs to create a new product node and show it to the user so that they can fill in some detail fields and then save it.
I'm trying to do this with Rules -> Create new entity. As "Entity type" I choose "Node" and as "Content type" I choose my product content type. Then I also need to fill in a title. There is where it goes wrong. I tried to put every type of data or string inside this Value field of Title and Rules accepts it and saves the rule. But every time the rules failes creating the node with the following error message:
Unable to create entity node": Invalid data value given. Be sure it matches the required data type and format.
How can I effectively create a new node of a certain content type and present it to the user for further finishing, all with rules?
I hope I could explain it clearly :)
Thank you :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论