Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update html_helper.php #3247

Merged
merged 2 commits into from
Jul 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions system/Helpers/html_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,10 @@ function script_tag($src = '', bool $indexPage = false): string
* @param string $title
* @param string $media
* @param boolean $indexPage should indexPage be added to the CSS path.
* @param string $hreflang
* @return string
*/
function link_tag($href = '', string $rel = 'stylesheet', string $type = 'text/css', string $title = '', string $media = '', bool $indexPage = false): string
function link_tag($href = '', string $rel = 'stylesheet', string $type = 'text/css', string $title = '', string $media = '', bool $indexPage = false, string $hreflang = ''): string
{
$link = '<link ';

Expand All @@ -286,6 +287,7 @@ function link_tag($href = '', string $rel = 'stylesheet', string $type = 'text/c
$type = $href['type'] ?? $type;
$title = $href['title'] ?? $title;
$media = $href['media'] ?? $media;
$hreflang = $href['hreflang'] ?? '';
$indexPage = $href['indexPage'] ?? $indexPage;
$href = $href['href'] ?? '';
}
Expand All @@ -306,7 +308,17 @@ function link_tag($href = '', string $rel = 'stylesheet', string $type = 'text/c
$link .= 'href="' . $href . '" ';
}

$link .= 'rel="' . $rel . '" type="' . $type . '" ';
if ($hreflang !== '')
{
$link .= 'hreflang="' . $hreflang .'" ';
}

$link .= 'rel="' . $rel . '" ';

if (! in_array($rel, ['alternate','canonical']))
{
$link .= 'type="' . $type . '" ';
}

if ($media !== '')
{
Expand All @@ -321,7 +333,8 @@ function link_tag($href = '', string $rel = 'stylesheet', string $type = 'text/c
return $link . '/>';
}
}
// ------------------------------------------------------------------------

// ------------------------------------------------------------------------

if (! function_exists('video'))
{
Expand Down