|
7 | 7 | * ---------------------------------------------------------------------- |
8 | 8 | * |
9 | 9 | * Software by Whirl-i-Gig (http://www.whirl-i-gig.com) |
10 | | - * Copyright 2010-2024 Whirl-i-Gig |
| 10 | + * Copyright 2010-2025 Whirl-i-Gig |
11 | 11 | * |
12 | 12 | * For more information visit http://www.CollectiveAccess.org |
13 | 13 | * |
@@ -230,8 +230,24 @@ public function __construct($id=null, ?array $options=null) { |
230 | 230 |
|
231 | 231 | parent::__construct($id, $options); |
232 | 232 |
|
| 233 | + $this->initSettings(); |
| 234 | + } |
| 235 | + # ------------------------------------------------------ |
| 236 | + /** |
| 237 | + * |
| 238 | + */ |
| 239 | + public function load($id=null, $use_cache=true) { |
| 240 | + $ret = parent::load($id, $use_cache); |
| 241 | + $this->initSettings(); |
| 242 | + return $ret; |
| 243 | + } |
| 244 | + # ------------------------------------------------------ |
| 245 | + /** |
| 246 | + * |
| 247 | + */ |
| 248 | + public function initSettings() { |
233 | 249 | // |
234 | | - $this->setAvailableSettings([ |
| 250 | + $settings = [ |
235 | 251 | 'show_empty_values' => [ |
236 | 252 | 'formatType' => FT_NUMBER, |
237 | 253 | 'displayType' => DT_CHECKBOXES, |
@@ -268,7 +284,25 @@ public function __construct($id=null, ?array $options=null) { |
268 | 284 | 'label' => _t('Show display in'), |
269 | 285 | 'description' => _t('Restrict display to use in specific contexts. If no contexts are selected the display will be shown in all contexts.') |
270 | 286 | ] |
271 | | - ]); |
| 287 | + ]; |
| 288 | + if((int)$this->get('table_num') === 57) { |
| 289 | + $settings['show_representations'] = [ |
| 290 | + 'formatType' => FT_TEXT, |
| 291 | + 'displayType' => DT_SELECT, |
| 292 | + 'width' => 4, 'height' => 1, |
| 293 | + 'takesLocale' => false, |
| 294 | + 'default' => 'all', |
| 295 | + 'options' => [ |
| 296 | + _t('No') => '', |
| 297 | + _t('All') => 'all', |
| 298 | + _t('Primary only') => 'primary' |
| 299 | + ], |
| 300 | + 'label' => _t('Display representations?'), |
| 301 | + 'description' => _t('Display primary or all representations at top of display?') |
| 302 | + ]; |
| 303 | + } |
| 304 | + |
| 305 | + $this->setAvailableSettings($settings); |
272 | 306 | } |
273 | 307 | # ------------------------------------------------------ |
274 | 308 | /** |
@@ -345,7 +379,13 @@ public function set($pa_fields, $pm_value="", $options=null) { |
345 | 379 | if ($pa_fields === 'table_num') { return false; } |
346 | 380 | } |
347 | 381 | } |
348 | | - return parent::set($pa_fields, $pm_value, $options); |
| 382 | + |
| 383 | + $ret = parent::set($pa_fields, $pm_value, $options); |
| 384 | + if((is_array($pa_fields) && isset($pa_fields['table_num'])) || ($oa_fields === 'table_num')) { |
| 385 | + $this->initSettings(); |
| 386 | + } |
| 387 | + |
| 388 | + return $ret; |
349 | 389 | } |
350 | 390 | # ------------------------------------------------------ |
351 | 391 | public function __destruct() { |
|
0 commit comments