]> git.joonet.de Git - adminer.git/commitdiff
Plugin edit-foreign: Add limit where it should stop creating a select
authorRobert Slootjes <robert@mediamonks.com>
Wed, 25 Jun 2014 14:21:44 +0000 (16:21 +0200)
committerJakub Vrana <jakub@vrana.cz>
Mon, 15 Sep 2014 04:40:57 +0000 (21:40 -0700)
plugins/edit-foreign.php

index 53e6a33c6309f0b6d40528bac20eb8700ac09719..82520d3ea31d75a0e196f53bfa08f5fbb3ebee73 100644 (file)
@@ -7,6 +7,11 @@
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
 */
 class AdminerEditForeign {
+       var $_limit;
+       
+       function AdminerEditForeign($limit = 50) {
+               $this->_limit = $limit;
+       }
        
        function editInput($table, $field, $attrs, $value) {
                static $foreignTables = array();
@@ -22,6 +27,9 @@ class AdminerEditForeign {
                                $options = &$values[$target][$id];
                                if (!$options) {
                                        $options = array("" => "") + get_vals("SELECT " . idf_escape($id) . " FROM " . table($target) . " ORDER BY 1");
+                                       if (count($options) - 1 > $this->_limit) {
+                                               return;
+                                       }
                                }
                                return "<select$attrs>" . optionlist($options, $value) . "</select>";
                        }