The performance in the backend is very bad and get timeouts or out of memory errors. Do you try to load all nodes of a type when changeing "Bundle"?
Maybe you can use a autocomplete field for Preview?

Comments

digitaldonkey’s picture

Version: 7.x-2.0-beta2 » 7.x-2.0

I Added a limit to avoid custom_formatters trying to do a node_load for 10000 entities.
It's a bad sulution to hard-Linit Like this. Would be great to have a Autocomplete Field here to load a certain node.

diff --git a/sites/all/modules/custom_formatters/plugins/export_ui/custom_formatters.inc b/sites/all/modules/custom_formatters/plugins/export_ui/custo
index 1621d66..a21569b 100644
--- a/sites/all/modules/custom_formatters/plugins/export_ui/custom_formatters.inc
+++ b/sites/all/modules/custom_formatters/plugins/export_ui/custom_formatters.inc
@@ -222,12 +222,14 @@ function _custom_formatters_preview_variables($form, $form_state) {
   // Entities
   $options['entities'] = array();
   if (!empty($options['fields'])) {
+    $limit = 300;  
     $field = !empty($item['preview']['field']) ? $item['preview']['field'] : key($options['fields']);
     $query = new EntityFieldQuery();
     $query->entityCondition('entity_type', $entity_type)
       ->entityCondition('bundle', $bundle)
       ->fieldCondition($field);
     $result = $query->execute();
+    $result['node'] = array_slice ($result['node'], 0, $limit , true);
     $entities = entity_load($entity_type, array_keys($result[$entity_type]));
     foreach ($entities as $key => $entity) {
       $options['entities'][$key] = "Entity ID #{$key}";

deciphered’s picture

Limit makes sense, I'd possible consider lowering it, 300 still seems to be a lot.

Also, can you actually upload the patch instead of pasting it in? When you do that, please set the issue to 'needs review'.

digitaldonkey’s picture

For my opinion this is too dirty to become a serious patch.
People will ask "post 301 will never get shown" if we commit this.

deciphered’s picture

To be honest, 300 is way to many, this is purely for testing the creation of a Formatter, if you can't do it with one entity then your doing something wrong (I'm not accusing you of doing something wrong, I'm making a point).

At most I think 10 should be more than enough, and maybe some way to search or filter the entities.

julien.reulos’s picture

Version: 7.x-2.0 » 7.x-2.x-dev

Hi,
I use the 7.x-2.x-dev version, and what I do to limit the result number is adding a range to the query:

<?php
$query->entityCondition('entity_type', $entity_type)
      ->entityCondition('bundle', $bundle)
      ->range(0,10)
      ->fieldCondition($field);
?>
deciphered’s picture

Status: Needs work » Fixed

Fix committed to 7.x-2.x-dev.

Limited to 50 randomised nodes.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

Updated a solution proposal