';
if ( $allow_default ) {
$default_label = $site > 0
? sprintf( /* translators: %d: site retention period in days. */ __( 'Site default: delete after %d days.', 'accessible-forms-by-accessible-org' ), $site )
: __( 'Site default: keep until manually deleted.', 'accessible-forms-by-accessible-org' );
echo '
' . esc_html( $default_label ) . '
';
}
echo '
' . esc_html( $allow_default ? __( 'Used only when deleting after a set number of days. Between 1 and 3,650 days.', 'accessible-forms-by-accessible-org' ) : __( 'Used only when deleting after a set number of days. Enter a whole number of at least 1 day.', 'accessible-forms-by-accessible-org' ) ) . '
';
echo '
' . esc_html__( 'Applies to new entries. Each submission keeps the retention policy in effect when it was received. Scheduled deletion runs daily.', 'accessible-forms-by-accessible-org' ) . '
';
if ( $locked ) {
echo '
' . esc_html__( 'Set in wp-config.php.', 'accessible-forms-by-accessible-org' ) . '
';
}
public static function select( $name, $label, array $options, $value, $id = '' ) {
$id = $id ?: 'af-opt-' . sanitize_html_class( str_replace( array( '[', ']' ), array( '-', '' ), $name ) );
echo '';
}
public static function check( $name, $label, $value ) {
echo '';
}
public static function notification_templates( array $schema, $legacy ) {
if ( current_user_can( 'manage_options' ) ) {
self::input( 'af_schema[cc]', __( 'CC (optional)', 'accessible-forms-by-accessible-org' ),
implode( "\n", (array) ( $schema['cc'] ?? array() ) ), 'textarea',
__( 'Enter one email address per line. CC addresses are visible to the other recipients of the main notification.', 'accessible-forms-by-accessible-org' ),
array( 'maxlength' => 5500 )
);
}
if ( $legacy ) {
self::check( 'af_schema[merge_subject]', __( 'Use page and submission tags in this subject', 'accessible-forms-by-accessible-org' ), ! empty( $schema['merge_subject'] ) );
echo '
' . esc_html__( 'This subject already uses a tag name that now has a built-in meaning. To keep using a question’s answer after switching, use its explicit tag, such as {field:date}.', 'accessible-forms-by-accessible-org' ) . '
';
}
self::tag_picker( 'subject', 'af-subject_template', __( 'Tag for email subject', 'accessible-forms-by-accessible-org' ), __( 'Insert tag in email subject', 'accessible-forms-by-accessible-org' ), $schema );
self::input( 'af_schema[body_template]', __( 'Email body (optional)', 'accessible-forms-by-accessible-org' ), $schema['body_template'] ?? '', 'textarea',
__( 'Leave blank to use the generated email. Write plain text and use {all_fields} to include the answers.', 'accessible-forms-by-accessible-org' ),
array( 'maxlength' => 10000 )
);
self::tag_picker( 'body', 'af-opt-af_schema-body_template', __( 'Tag for email body', 'accessible-forms-by-accessible-org' ), __( 'Insert tag in email body', 'accessible-forms-by-accessible-org' ), $schema );
}
private static function tag_picker( $key, $target, $label, $button, array $schema ) {
$id = 'af-' . $key . '-answer';
echo '
';
echo '
';
}
/**
* Fields of the form being edited, in order.
*
* @return array[]
*/
public static function fields() {
return self::$fields;
}
public static function top( $post, array $schema ) {
self::$fields = $schema['fields'];
Flow::top( $post, $schema );
}
public static function field_type_options( $base, array $field ) {
$type = $field['type'];
echo '
';
self::input( $base . '[content]', __( 'Content block text', 'accessible-forms-by-accessible-org' ), $field['content'] ?? '', 'textarea',
__( 'Separate paragraphs with a blank line. To format text, use for bold, for italics, for links, and
' .
esc_html__(
'Useful on a “Report a problem” page: when a visitor arrives from another page of this site, its address (without any query string) is filled in. Visitors can change or clear it. Requires JavaScript.',
'accessible-forms-by-accessible-org'
) .
'