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

Add an option to add a simple favicon.ico to the root of the Contao installation #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion system/modules/easyFavicon/classes/easyFavicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ public function addFavicon($objPage, $objLayout, $self)
{
$favicon = 'share/favicon-' . $rootPage->alias . '.ico';
$this->createIco( TL_ROOT . '/' . $objFavicon->path, $favicon );
if($rootPage->faviconToRoot)
{
$rootFavicon = 'favicon.ico';
$this->createIco( TL_ROOT . '/' . $objFavicon->path, 'favicon.ico' );
}
}

if( $favicon )
Expand Down Expand Up @@ -109,4 +114,4 @@ private function createIco( $srcFile, $savePath )
$objFile->write( $icoFile->_get_ico_data() );
$objFile->close();
}
}
}
13 changes: 11 additions & 2 deletions system/modules/easyFavicon/dca/tl_page.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$GLOBALS['TL_DCA']['tl_page']['palettes']['root'] = str_replace('{publish_legend}', '{favicon_legend:hide},addFavicon,addAppleTouchIcon;{publish_legend}', $GLOBALS['TL_DCA']['tl_page']['palettes']['root']);

// Subpalettes
$GLOBALS['TL_DCA']['tl_page']['subpalettes']['addFavicon'] = 'faviconSRC';
$GLOBALS['TL_DCA']['tl_page']['subpalettes']['addFavicon'] = 'faviconSRC,faviconToRoot';
$GLOBALS['TL_DCA']['tl_page']['subpalettes']['addAppleTouchIcon'] = 'appleTouchIconSRC';

// Fields
Expand All @@ -47,6 +47,15 @@
'sql' => "binary(16) NULL"
);

$GLOBALS['TL_DCA']['tl_page']['fields']['faviconToRoot'] = array
(
'label' => array('Favicon to ROOT', 'Add this favicon as favicon.ico to the root'),
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('unique'=>true, 'tl_class'=>'clr w50'),
'sql' => "char(1) NOT NULL default ''"
);

$GLOBALS['TL_DCA']['tl_page']['fields']['addAppleTouchIcon'] = array
(
'label' => &$GLOBALS['TL_LANG']['tl_page']['addAppleTouchIcon'],
Expand All @@ -63,4 +72,4 @@
'inputType' => 'fileTree',
'eval' => array('filesOnly'=>true, 'fieldType'=>'radio', 'extensions' =>'png', 'mandatory'=>true, 'tl_class'=>'w50 easyFavicon'),
'sql' => "binary(16) NULL"
);
);