-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #127 from Web-Ex-Machina/master
Fix 2 bugs in tl_page extends
- Loading branch information
Showing
25 changed files
with
551 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,11 @@ Thumbs.db | |
.build/ | ||
.idea/ | ||
nbproject/ | ||
*.sublime-* | ||
|
||
# Vendors | ||
/vendor | ||
|
||
# Distribution | ||
/dist | ||
/build | ||
/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
namespace Verstaerker\I18nl10nBundle\Hook; | ||
|
||
/** | ||
* Class GetArticleHook | ||
* @package Verstaerker\I18nl10nBundle\Hook | ||
* | ||
* Determine when to show content elements in relation to the current page language. | ||
*/ | ||
class GetArticleHook | ||
{ | ||
/** | ||
* Check if the current article has visible elements and return an empty template if not | ||
* @param [ArticleModel] $objRow Article row | ||
* @return [nothing] | ||
*/ | ||
public function checkIfEmpty($objRow) | ||
{ | ||
$objElements = \ContentModel::findPublishedByPidAndTable($objRow->id, "tl_article"); | ||
|
||
$blnDisplay = false; | ||
if ($objElements && $objElements->count() > 0) { | ||
while ($objElements->next()) { | ||
if ($objElements->language == "" || $objElements->language == $GLOBALS['TL_LANGUAGE']) { | ||
$blnDisplay = true; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
if (!$blnDisplay) { | ||
$objRow->customTpl = "mod_i18nl10n_article_empty"; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
|
||
namespace Verstaerker\I18nl10nBundle\Hook; | ||
|
||
use Contao\Controller; | ||
use Verstaerker\I18nl10nBundle\Classes\I18nl10n; | ||
|
||
/** | ||
* Class InitializeSystemHook | ||
* @package Verstaerker\I18nl10nBundle\Hook | ||
* | ||
* Implementation of i18nl10n search logic. | ||
*/ | ||
class InitializeSystemHook | ||
{ | ||
public function initializeSystem() | ||
{ | ||
// If there is no request, add the browser language | ||
if ("" === \Environment::get('request')) { | ||
// check if the browser language is available | ||
$arrLanguages = I18nl10n::getInstance()->getAvailableLanguages(); | ||
$userLanguage = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2); | ||
|
||
$languages = $arrLanguages[$_SERVER['HTTP_HOST']] ?: $arrLanguages['*']; | ||
|
||
if (in_array($userLanguage, $languages['languages'])) { | ||
$strRedirect = $userLanguage."/"; | ||
} else { | ||
$strRedirect = $languages['default']."/"; | ||
} | ||
|
||
Controller::redirect($strRedirect); | ||
} | ||
|
||
// If we are on the homepage, remove the urlSuffix | ||
$arrFragments = explode("/", \Environment::get('request')); | ||
if ("" === $arrFragments[1] && "" != \Config::get('urlSuffix')) { | ||
\Config::set('tmpUrlSuffix', \Config::get('urlSuffix')); | ||
\Config::set('urlSuffix', ""); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.