Field::id( string $str = false )
Description #
Return safe css ID.
Parameters #
- $strstring (Optional) String. Default value: false
Source #
File: lib/form/class-field.php
public function id( $str = false ) {
if ( ! empty( $this->field_id ) ) {
return $this->field_id;
}
if ( false === $str ) {
$str = $this->field_name;
}
return sanitize_html_class(
rtrim( preg_replace( '/-+/', '-', str_replace( array( '[', ']' ), '-', $str ) ), '-' )
);
}
Expand full source code Collapse full source code View on GitHub: lib/form/class-field.php:437
Add your comment