Is there a way to input the data of multiple content types all on the same page in Drupal 8?

こ雲淡風輕ζ 提交于 2019-12-13 03:13:57

问题


I have three content types: student, course, and student_takes_course (student_takes_course have two reference fields that points to the student and course content types).

To input a new student_takes_course record, I would first have to go to the student content type and input a new student record, and then go to the course content type and input a new course record, and only then I can go to the student_takes_course content type and input a new record that have references to the newly inputted student and course records).

But is there a way to input the student and course and student_takes_course records all on the same page?


回答1:


Inline entity form allows you to create new, or reference existing, entities while creating/editing a parent.

This is a hugly powerful module, but can become confusing if you use it on both the parent and child, e.g. student_takes_course has an IEF referencing student, and student and a corresponding IEF referencing student_takes_course.

In this case you can create a new student (2) from student_takes_course (1) and then create a new student_takes_course (3) from student (2) and then a new sstudent (4) from student_takes_course (3 and so on.

  • student_takes_course
    • student
      • student_takes_course
        • student

The way around this is to use form modes to limit the fields shown in each IEF. Or don't have corresponding reference fields…



来源:https://stackoverflow.com/questions/52398614/is-there-a-way-to-input-the-data-of-multiple-content-types-all-on-the-same-page

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!