acf_field_url::render_field
Create the HTML interface for your field
Method of the class: acf_field_url{}
No Hooks.
Returns
null. Nothing (null).
Usage
$acf_field_url = new acf_field_url(); $acf_field_url->render_field( $field );
- $field(required)
- .
Changelog
| Since 3.6 | Introduced. |
acf_field_url::render_field() acf field url::render field code ACF 6.0.4
function render_field( $field ) {
// vars
$atts = array();
$keys = array( 'type', 'id', 'class', 'name', 'value', 'placeholder', 'pattern' );
$keys2 = array( 'readonly', 'disabled', 'required' );
$html = '';
// atts (value="123")
foreach ( $keys as $k ) {
if ( isset( $field[ $k ] ) ) {
$atts[ $k ] = $field[ $k ];
}
}
// atts2 (disabled="disabled")
foreach ( $keys2 as $k ) {
if ( ! empty( $field[ $k ] ) ) {
$atts[ $k ] = $k;
}
}
// remove empty atts
$atts = acf_clean_atts( $atts );
// render
$html .= '<div class="acf-input-wrap acf-url">';
$html .= '<i class="acf-icon -globe -small"></i>' . acf_get_text_input( $atts );
$html .= '</div>';
// return
echo $html;
}