mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Add TreeDropdownField from React to Entwine
This commit is contained in:
parent
458e919a69
commit
120c772966
@ -606,6 +606,26 @@ class TreeDropdownField extends FormField
|
||||
return $callback && call_user_func($callback, $node);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attributes to be given for this field type
|
||||
* @return array
|
||||
*/
|
||||
public function getAttributes()
|
||||
{
|
||||
$attributes = array(
|
||||
'class' => $this->extraClass(),
|
||||
'id' => $this->ID(),
|
||||
'data-schema' => json_encode($this->getSchemaData()),
|
||||
'data-state' => json_encode($this->getSchemaState()),
|
||||
);
|
||||
|
||||
$attributes = array_merge($attributes, $this->attributes);
|
||||
|
||||
$this->extend('updateAttributes', $attributes);
|
||||
|
||||
return $attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $field
|
||||
* @return $this
|
||||
|
@ -1,8 +1,7 @@
|
||||
<div class="TreeDropdownField <% if $extraClass %> $extraClass<% end_if %><% if $ShowSearch %> searchable<% end_if %>"
|
||||
data-url-tree="$Link('tree')"
|
||||
data-title="$Title.ATT"
|
||||
data-empty-title="$EmptyTitle.ATT"
|
||||
<% if $Description %>title="$Description.ATT"<% end_if %>
|
||||
<% if $Metadata %>data-metadata="$Metadata.ATT"<% end_if %> tabindex="0">
|
||||
<div
|
||||
class="TreeDropdownField<% if $extraClass %> $extraClass<% end_if %><% if $ShowSearch %> searchable<% end_if %>"
|
||||
$AttributesHTML('class')
|
||||
<% if $Metadata %>data-metadata="$Metadata.ATT"<% end_if %>
|
||||
>
|
||||
<input id="$ID" type="hidden" name="$Name.ATT" value="$Value.ATT" />
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user