Changing ZF2 Core 2.4.13 Zend\View\Helper\HeadLink::createDataStylesheet

class: Zend\View\Helper\HeadLink
function: createDataStylesheet
php version: 7.3

public function createDataStylesheet(array $args)
{
$rel = ‘stylesheet’;
$type = ‘text/css’;
$media = ‘screen’;
$conditionalStylesheet = false;
$href = array_shift($args);
if ($this->isDuplicateStylesheet($href)) { return false; } if (0 < count($args)) { $media = array_shift($args); if (is_array($media)) { $media = implode(',', $media); } else { $media = (string) $media; } } if (0 < count($args)) { $conditionalStylesheet = array_shift($args); if (!empty($conditionalStylesheet) && is_string($conditionalStylesheet)) { $conditionalStylesheet = (string) $conditionalStylesheet; } else { $conditionalStylesheet = null; } } $attributes = compact('rel', 'type', 'href', 'media', 'conditionalStylesheet'); if (0 < count($args) && is_array($args[0])) { $extras = array_shift($args); $attributes['extras'] = (array) $extras; } return $this->createData($attributes); }

new/modified/final/current code

public function createDataStylesheet(array $args)
{
$rel = ‘stylesheet’;
$type = ‘text/css’;
$media = ‘screen’;
$conditionalStylesheet = false;
$href = array_shift($args);
if ($this->isDuplicateStylesheet($href)) { return false; } if (0 < count($args)) { $media = array_shift($args); if (is_array($media)) { $media = implode(',', $media); } else { $media = (string) $media; } } if (0 < count($args)) { $conditionalStylesheet = array_shift($args); if (!empty($conditionalStylesheet) && is_string($conditionalStylesheet)) { $conditionalStylesheet = (string) $conditionalStylesheet; } else { $conditionalStylesheet = null; } } if (0 < count($args) && is_array($args[0])) { $extras = array_shift($args); $extras = (array) $extras; } $attributes = compact('rel', 'type', 'href', 'media', 'conditionalStylesheet', 'extras'); return $this->createData($attributes); }

previous/original/old code
Posted in php, zf2Tagged , , , ,