Have hundreds of items in one multivalued field?

Sounds like a bad design? When the first time I found out this, I thought that we should have avoided it in design. But, that is not what we are talking today. After we figured out a way to fix the performance, it seems quite a powerful way to deal with the business logic.

How to accommodate the request that a node holds thousands of multiple value items in one field? When it comes to editor experience, we have something to share. Multiple values field for a field-collection-item is a usual setup for a content type. When there are only couple dozens of values, everything is good. The default field-collection embed widget with a multivalue field is working well.

As the number of items goes up, the editing page become heavier. In our case, we have a field collection contains five subfields. There is one entity reference field pointing to nodes, two text fields, one taxonomy entity reference field and a number field. Some nodes have over 300 such field collection items. The editing pages for those nodes are like taking forever to load. Updating the node getting more and more difficult.

for such a node, the edit form has thousands of form elements. It is like loading an adult elephant with a small pickup truck. Anything can slow down the page. That can be from web server performance to the network bandwidth and our local computer browser capability. So, we need to find a valid way to handle it. We want the multiple value field to be truly unlimited. Make it capable of holding thousands of field-collection-items value in a single node.

After doing some research, we come with a pretty good solution. Here is what we had done to deal with it.

We use Embeded Views Field to build a block for the field collection items. We paginate it and break down 300 items into 12 pages. Then, we insert the views block into the node editing page. Not loading all the elements into the node editing form, it speeds up the page loading immediately. Display the field collection items in views block is not enough, we need to edit them. I had tried to use the VBO to handle editing and deleting. It did not work. Then we built some custom ajax functions for editing and deleting. We use the ctools modal window as front end interface to edit, delete and add new items. That works well. With modal window and Ajax, we can keep the main node edit page untouched. There is no need to refresh the page every time they change the field-collection-items. Thanks to the pagination of the views block. We now can add as many items as we want into the field collection multivalue field. We added views sorting function to the embedded views field.

Sounds pretty robust, but wait, there is something missing. We quickly running into problem soon we implement it. What about the form to create a new node? On the new node page, the embedded views field block is not working. A new node does not have its node id. We fixed it by using the default widget. It is just for the new node page. We used the following function to switch the field widget.

function MODULENAME_field_widget_properties_alter(&$widget, $context) {
  if ($context['entity_type'] == 'node') {
    if (!isset($context['entity']->nid)) {
      if ($context['field']['field_name'] == 'FIELD_MACHINE_NAME') {
        if ($widget['type'] == 'field_collection_hidden') {
          $widget['type'] = 'field_collection_embed';


Are you sure there was not a better logic?

Thousands of embed things sounds scary... are you sure there is not a better way to handle the logic? Once you figure it out, "just" build and run the migration path :) what about saving everything in a json it loads fast?

Thanks for sharing your

Thanks for sharing your solution. As you mention in your post, it's also necessary to edit the field items, not just display them. Could you share the "custom ajax functions for editing and deleting" that you built to implement edit / delete capabilities in the embedded view?

We used the Editable Fields

Try the Editable Fields module.

Интересная фотоподборка

Привет всем участникам! Нашел познавательную фотосессию на этом сайте: http://coolrobo.ru : http://coolrobo.ru/foto-prikoly-interesnoe/5947-simpatichnye-doma-iz-plastikovyh-butylok.html <b> Симпатичные дома из пластиковых бутылок </b> <a href=http://coolrobo.ru/foto-prikoly-interesnoe/4535-strany-bez-podohodnogo-naloga.html> Страны без подоходного налога </a> http://coolrobo.ru/foto-prikoly-interesnoe/1671-miss-mira-2014-predstavit-anastasiya-kostenko.html

сериалы 2017 смотреть хорошем качестве русские криминальные

Привет всем участникам форума! класный у вас сайт! Нашел прикольную базу кино: <b> храброе сердце мультфильм в хорошем качестве онлайн </b> <a href=http://kinokub.net/>http://kinokub.net/</a> Тут: <a href=http://kinokub.net/fentezi/>самые лучшие фильмы фэнтези смотреть онлайн</a> фэнтези смотреть бесплатно в хорошем качестве список 2017 Здесь: Онлайн лучшие драмы http://kinokub.net/drama/ список 2018 Здесь: Документальные фильмы онлайн смотреть http://kinokub.net/dokumentalnyy/ список 2017 Здесь: http://kinokub.net/melodrama/4263-druzhba-i-nikakogo-seksa-what-if-2013.html <b> Смотреть Дружба и никакого секса? / What If (2013) онлайн бесплатно </b> Здесь: http://kinokub.net/raznoe/5831-rozhdestvenskiy-zherebenok-the-christmas-colt-2013.html

Best Spa body rub in New Yourk

In spa salon grooming massage masseurs can do the sexiest Aromatherapy. Our women enough qualified in order to at the end session body to body massage you felt yourself easy good and were always ready to indescribable sexual feats. The spa salon erotic invites visit one of the options massage, is what we do. The beautiful masseuses our the spa will give you an unforgettable experience. The spa is a place of rest and relaxation. We in N.Y.C. are ready to provide beautiful placement with convenient style. These placement promote be you you are staying with us incognito. Attractive massage therapists will make you Intimate massage and relaxing massage, you can select several varieties massage on your solution. Success organization nuru massage composed, in order that, in 1st you received from him satisfaction. Warm touching chic masters of massage there will be a flow on your body, immersing in abyss boundless seas pleasure. In the slow slip, covering your body kisses, prelestress enshroud the warmth of one's body. You personally be able to be surprised by that, which sea enjoyment you can know fromSoapy massage in Empire State Our showroom works in Downtown. Girls Trinity <a href=https://japanese.massage-manhattan-club.com>japanese massage cabinet</a>

So I think the problem is how to find the theme.

So I think the problem is how to find the theme. http://xn--o80b27i69npibp5en0j.zxc700.com - 온라인카지노 http://xn--o80b910a26eepc81il5g.zxc700.com - 카지노사이트 http://xn--c79a67g3zy6dt4w.zxc700.com - 카지노검증사이트 http://xn--oi2b43dh5aa317l40j.zxc700.com - 모바일바카라 http://xn--oi2b30g3ueowi6mjktg.zxc700.com - 바카라사이트 http://xn--oi2ba146a24mbtbtvt.zxc700.com - 온라인바카라 http://xn--o80bz00bbzcu6f.zxc700.com - 샌즈카지노 http://xn--oi2b30ghxt.zxc700.com - 바카라 http://xn--on3b21eb4bmwh91q.zxc700.com - 바카라주소

The way content is produced

The way content is produced has changed, and the distribution success equation has changed. http://xn--o80b910a26eepc81il5g.vom77.com - 카지노사이트 http://xn--o80b67oh5az7z4wcn0j.vom77.com - 모바일카지노 http://xn--mp2bs6av7jp7brh74w2jv.vom77.com - 슬롯머신사이트 http://xn--o80b27i69npibp5en0j.vom77.com - 온라인카지노 http://xn--vf4b27jfzgc8d5ub.vom77.com - 포커사이트 http://xn--7m2b7ov9poqh97o.vom77.com - 룰렛사이트 http://xn--oi2b30g3ueowi6mjktg.vom77.com - 바카라사이트 http://xn--o80by81agsfmwa85o.vom77.com - 카지노주소 http://xn--ij2bx6j77bo2kdi289c.vom77.com - 블랙잭사이트

this is probably the shape

this is probably the shape of a goldfish's mouth where the end of the flower is sore <a href="http://dd.vmm789.com" target="_blank">온라인카지노</a> <a href="http://et.vmm789.com" target="_blank">온라인바카라</a> <a href="http://tt.vmm789.com" target="_blank">룰렛사이트</a> <a href="http://zxc.vmm789.com" target="_blank">슬롯머신사이트</a> <a href="http://vmm789.com" target="_blank">카지노사이트</a>


https://x6m4i1832.weebly.com 카지노드래곤타이거 아쿠아슬롯 이제 어떻게 한다? 프란체스카는 속으로 중얼거렸다. 그렇게 <a href="https://cq16ip6465.weebly.com " target="_blank">게임바둑</a> https://ig335cs1575.weebly.com https://1510936.site123.me 「난 할 일이 많고 게다가...」 <a href="https://fs108gj4674.weebly.com " target="_blank">카지노가있는나라</a> <a href="https://bu64uv3508.weebly.com " target="_blank">카지노드롭</a> <a href="https://p8p9w1315.weebly.com " target="_blank">바카라전략노하우</a> 베트남나짱카지노 https://1533504.site123.me 두 사람이 호텔로 돌아오자 테드가 맥주를 마시고 있었다. 스코어 프로토결과

Add new comment

Target Image