From 3ac01fde20ffa81c6e2ab50a5a4cd9299773be9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= <come.bernigaud@opensides.be> Date: Fri, 1 Apr 2016 10:41:18 +0200 Subject: [PATCH] Fixes #4659 Added a way for plugin to say which attributes should not be asked in the template --- include/class_template.inc | 2 +- include/simpleplugin/class_simplePlugin.inc | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/class_template.inc b/include/class_template.inc index 21bd8bc80..3802e0006 100644 --- a/include/class_template.inc +++ b/include/class_template.inc @@ -50,7 +50,7 @@ class template $this->attributes[$class] = array(); $attrs = array_unique(array_merge($this->tabObject->by_object[$class]->getRequiredAttributes(), $this->needed)); foreach (array_keys($this->tabObject->by_object[$class]->attributesAccess) as $attr) { - if (isset($this->attrs[$attr])) { + if (!$plugin->showInTemplate($attr, $this->attrs)) { continue; } if (in_array($attr, $attrs)) { diff --git a/include/simpleplugin/class_simplePlugin.inc b/include/simpleplugin/class_simplePlugin.inc index f45a075ba..15934fcfa 100644 --- a/include/simpleplugin/class_simplePlugin.inc +++ b/include/simpleplugin/class_simplePlugin.inc @@ -988,6 +988,15 @@ class simplePlugin extends plugin } unset($attr); } + + /* Returns TRUE if this attribute should be asked in the creation by template dialog */ + function showInTemplate($attr, $templateAttrs) + { + if (isset($templateAttrs[$attr])) { + return FALSE; + } + return TRUE; + } } ?> -- GitLab