Tribe__Events__Pro__Editor::after_custom_field_content( $ticket, $index, $count )
Attach a new input after each custom field input is rendered, the value is being stored in a hidden field and creates a fake <button> to have A11y benefits like focus and so on. The “fake checkbox” is used as we need to send to the request the value of this operation regardless of is true / false so using a native checkbox send only the value when the checkbox is mark as “checked”, with this approach the “hidden” field is always being send into the request regardless of the state of it so we can have a valid reference all the time to the value of each custom field.
Contents
Parameters
- $ticket
-
(Required)
- $index
-
(Required)
- $count
-
(Required)
Return
(mixed)
Source
File: src/Tribe/Editor.php
public function after_custom_field_content( $ticket, $index, $count ) {
$value = '1';
if ( isset( $ticket['gutenberg_editor'] ) ) {
$value = $ticket['gutenberg_editor'] ? '1' : '0';
}
$args = array(
'input_id' => 'gutenberg_editor_' . esc_attr( $index ),
'value' => $value,
'index' => $index,
'class_name' => $value === '1' ? 'tribe-custom-field-gutenberg-checkbox--checked' : '',
'count' => $count,
);
$html = tribe( 'events-pro.editor.admin.template' )->template( array( 'custom-fields', 'gutenberg' ), $args, false );
echo $html;
}
Changelog
| Version | Description |
|---|---|
| 4.5 | Introduced. |