Collapsed items should default to or include the group name - Refs #2772
This commit is contained in:
parent
dac744dbc6
commit
c52f91a6d2
|
|
@ -175,8 +175,8 @@ class Repeater extends FormWidgetBase
|
|||
|
||||
$loadValue = $this->getLoadValue();
|
||||
if (is_array($loadValue)) {
|
||||
foreach ($loadValue as $loadedValue) {
|
||||
$loadedIndexes[] = array_get($loadedValue, '_index');
|
||||
foreach ($loadValue as $index => $loadedValue) {
|
||||
$loadedIndexes[] = array_get($loadedValue, '_index', $index);
|
||||
$loadedGroups[] = array_get($loadedValue, '_group');
|
||||
}
|
||||
}
|
||||
|
|
@ -338,4 +338,14 @@ class Repeater extends FormWidgetBase
|
|||
{
|
||||
return array_get($this->indexMeta, $index.'.groupCode');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the group title from its unique code.
|
||||
* @param $groupCode string
|
||||
* @return string
|
||||
*/
|
||||
public function getGroupTitle($groupCode)
|
||||
{
|
||||
return array_get($this->groupDefinitions, $groupCode.'.name');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,7 +173,12 @@
|
|||
|
||||
Repeater.prototype.getCollapseTitle = function($item) {
|
||||
var $target,
|
||||
defaultText = ''
|
||||
defaultText = '',
|
||||
explicitText = $item.data('collapse-title')
|
||||
|
||||
if (explicitText) {
|
||||
return explicitText
|
||||
}
|
||||
|
||||
if (this.options.titleFrom) {
|
||||
$target = $('[data-field-name="'+this.options.titleFrom+'"]')
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
<?php
|
||||
$groupCode = $useGroups ? $this->getGroupCodeFromIndex($indexValue) : '';
|
||||
$itemTitle = $useGroups ? $this->getGroupTitle($groupCode) : null;
|
||||
?>
|
||||
<li class="field-repeater-item">
|
||||
<li
|
||||
<?= $itemTitle ? 'data-collapse-title="'.$itemTitle.'"' : '' ?>
|
||||
class="field-repeater-item">
|
||||
|
||||
<div class="repeater-item-handle <?= $this->getId('items') ?>-handle">
|
||||
<i class="icon-bars"></i>
|
||||
|
|
|
|||
Loading…
Reference in New Issue