acf_get_empty_block_form_html()
Render the empty block form for when a block has no fields assigned.
Хуки из функции
Возвращает
Строку. The html that makes up a block form with no fields.
Использование
acf_get_empty_block_form_html( $block_name );
- $block_name(строка) (обязательный)
- The block name current being rendered.
Список изменений
| С версии 6.0.0 | Введена. |
Код acf_get_empty_block_form_html() acf get empty block form html ACF 6.4.2
function acf_get_empty_block_form_html( $block_name ) {
$message = __( 'This block contains no editable fields.', 'acf' );
if ( acf_current_user_can_admin() ) {
$message .= ' ';
$message .= sprintf(
/* translators: %s: an admin URL to the field group edit screen */
__( 'Assign a <a href="%s" target="_blank">field group</a> to add fields to this block.', 'acf' ),
admin_url( 'edit.php?post_type=acf-field-group' )
);
}
$message = apply_filters( 'acf/blocks/no_fields_assigned_message', $message, $block_name );
if ( ! is_string( $message ) ) {
$message = '';
}
if ( empty( $message ) ) {
return acf_esc_html( '<div class="acf-empty-block-fields"></div>' );
} else {
return acf_esc_html( '<div class="acf-block-fields acf-fields acf-empty-block-fields">' . $message . '</div>' );
}
}