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);
|
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
|
* @param string $field
|
||||||
* @return $this
|
* @return $this
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
<div class="TreeDropdownField <% if $extraClass %> $extraClass<% end_if %><% if $ShowSearch %> searchable<% end_if %>"
|
<div
|
||||||
data-url-tree="$Link('tree')"
|
class="TreeDropdownField<% if $extraClass %> $extraClass<% end_if %><% if $ShowSearch %> searchable<% end_if %>"
|
||||||
data-title="$Title.ATT"
|
$AttributesHTML('class')
|
||||||
data-empty-title="$EmptyTitle.ATT"
|
<% if $Metadata %>data-metadata="$Metadata.ATT"<% end_if %>
|
||||||
<% if $Description %>title="$Description.ATT"<% end_if %>
|
>
|
||||||
<% if $Metadata %>data-metadata="$Metadata.ATT"<% end_if %> tabindex="0">
|
|
||||||
<input id="$ID" type="hidden" name="$Name.ATT" value="$Value.ATT" />
|
<input id="$ID" type="hidden" name="$Name.ATT" value="$Value.ATT" />
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user