Widget_Abstract::get_admin_data( TribeWidgetarray $arguments, int $field_name, TribeWidgetarray $field )
Handles gathering the data for admin fields.
Contents
Parameters
- $arguments
-
(<span class="TribeWidgetarray">TribeWidgetarray) (Required) Current set of arguments.
- $field_name
-
(int) (Required) The ID of the field.
- $field
-
(<span class="TribeWidgetarray">TribeWidgetarray) (Required) The field info.
Return
(TribeWidgetarray<string,mixed>) $data The assembled field data.
Source
File: src/Tribe/Widget/Widget_Abstract.php
public function get_admin_data( $arguments, $field_name, $field ) {
$data = [
'classes' => Arr::get( $field, 'classes', '' ),
'dependency' => $this->format_dependency( $field ),
'id' => $this->get_field_id( $field_name ),
'label' => Arr::get( $field, 'label', '' ),
'name' => $this->get_field_name( $field_name ),
'options' => Arr::get( $field, 'options', [] ),
'placeholder' => Arr::get( $field, 'placeholder', '' ),
'value' => Arr::get( $arguments, $field_name ),
];
$children = Arr::get( $field, 'children', [] );
if ( ! empty( $children ) ) {
foreach ( $children as $child_name => $child ) {
$input_name = ( 'radio' === $child['type'] ) ? $field_name : $child_name;
$child_data = $this->get_admin_data(
$arguments,
$input_name,
$child
);
$data['children'][ $child_name ] = $child_data;
}
}
$data = array_merge( $field, $data );
// @todo properly filter this.
return apply_filters( 'tribe_widget_field_data', $data, $field_name, $this );
}
Changelog
| Version | Description |
|---|---|
| 5.3.0 | |
| 4.13.0 | Introduced. |