/**
* Method to render data attributes to html.
*
* @return string A HTML Tag Attribute string of data attribute(s)
*
* @since 4.0.0
*/
public function renderDataAttributes()
{
$dataAttribute = '';
$dataAttributes = $this->getDataAttributes();
if (!empty($dataAttributes)) {
foreach ($dataAttributes as $key => $attrValue) {
$dataAttribute .= ' ' . $key . '="' . htmlspecialchars($attrValue, ENT_COMPAT, 'UTF-8') . '"';
}
}
return $dataAttribute;
}