From 41e9dbad3b6b8754299c406f254774f53c9623cf Mon Sep 17 00:00:00 2001 From: Steph Prince <40640337+stephprince@users.noreply.github.com> Date: Wed, 24 Jan 2024 12:42:46 -0800 Subject: [PATCH] add option to use a value's html field generation method --- src/hdmf/container.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hdmf/container.py b/src/hdmf/container.py index 614fbbccd..889fcf490 100644 --- a/src/hdmf/container.py +++ b/src/hdmf/container.py @@ -626,7 +626,10 @@ def _generate_html_repr(self, fields, level=0, access_code="", is_field=False): if isinstance(fields, dict): for key, value in fields.items(): current_access_code = f"{access_code}.{key}" if is_field else f"{access_code}['{key}']" - html_repr += self._generate_field_html(key, value, level, current_access_code) + if hasattr(value, '_generate_field_html'): + html_repr += value._generate_field_html(key, value, level, current_access_code) + else: + html_repr += self._generate_field_html(key, value, level, current_access_code) elif isinstance(fields, list): for index, item in enumerate(fields): access_code += f'[{index}]'