-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add theme license description and buy button
- Loading branch information
Showing
5 changed files
with
120 additions
and
1 deletion.
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
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,87 @@ | ||
<?php | ||
|
||
/* | ||
* Replace label function | ||
*/ | ||
$GLOBALS['TL_DCA']['tl_theme']['list']['label']['label_callback'] = array('tl_theme_extended', 'addPreviewImageAndDesc'); | ||
|
||
/* | ||
* add fields to pallet | ||
*/ | ||
$GLOBALS['TL_DCA']['tl_theme']['palettes']['default'] = str_replace | ||
( | ||
',author', | ||
',author,pdir_th_description,pdir_th_license_domain', | ||
$GLOBALS['TL_DCA']['tl_theme']['palettes']['default'] | ||
); | ||
|
||
/** | ||
* Add fields to tl_theme | ||
*/ | ||
$GLOBALS['TL_DCA']['tl_theme']['fields']['pdir_th_description'] = array | ||
( | ||
'label' => &$GLOBALS['TL_LANG']['tl_theme']['pdir_th_description'], | ||
'exclude' => true, | ||
'search' => false, | ||
'sorting' => false, | ||
'inputType' => 'textarea', | ||
'eval' => array('readonly' => false), | ||
'sql' => "mediumtext NULL" | ||
); | ||
|
||
$GLOBALS['TL_DCA']['tl_theme']['fields']['pdir_th_license_domain'] = array | ||
( | ||
'label' => &$GLOBALS['TL_LANG']['tl_theme']['pdir_th_license_domain'], | ||
'exclude' => true, | ||
'inputType' => 'text', | ||
'eval' => array('tl_class' => 'w50', 'maxlength'=> 128), | ||
'sql' => "varchar(128) NOT NULL default ''" | ||
); | ||
|
||
class tl_theme_extended extends tl_theme | ||
{ | ||
/** | ||
* Add an image and a description to each record | ||
* | ||
* @param array $row | ||
* @param string $label | ||
* | ||
* @return string | ||
*/ | ||
public function addPreviewImageAndDesc($row, $label) | ||
{ | ||
// add buy action if needed | ||
if ($row['pdir_th_description'] != '') | ||
{ | ||
$label = '<span><img src="bundles/system/modules/theme_installer/assets/img/buy_theme.png" title="' . $GLOBALS['TL_LANG']['tl_theme']['buyTheme'] . '"' . | ||
' onclick="Backend.getScrollOffset();Backend.openModalSelector({\'width\':768,\'title\':\'' . $GLOBALS['TL_LANG']['MSC']['buyThemeButtonTitle'] . '\',\'url\':\'https://contao-themes.net/buy-mate.html\',\'id\':\'buyTheme\'});return false"' . | ||
' style="position:absolute;margin:10px 0;"></span>' . $label; | ||
} | ||
|
||
// add image | ||
$label = $this->addPreviewImage($row, $label); | ||
|
||
// add theme and license description | ||
if ($row['pdir_th_description'] != '') | ||
{ | ||
// add info icon | ||
$html = '<i class="icon" onmouseover="document.getElementById(\'themeDesc\').style.display = \'block\'"'. | ||
' onmouseout="document.getElementById(\'themeDesc\').style.display = \'none\'"'. | ||
' style="color:#fff;border-radius:50%;font-weight:bold;padding:3px;border:1px solid #649d9a;background:#649d9a;margin-left:5px;">i</i>'; | ||
|
||
// license status | ||
if($row['pdir_th_license_domain'] != '') | ||
$html .= $GLOBALS['TL_LANG']['tl_theme']['pdir_th_payed_license_text'] . $row['pdir_th_license_domain'] .'<br>'; | ||
else | ||
$html .= $GLOBALS['TL_LANG']['tl_theme']['pdir_th_license_text'] . '<br>'; | ||
|
||
// desc | ||
$html .= '<div id="themeDesc" style="display:none;">'; | ||
$html .= \StringUtil::decodeEntities($row['pdir_th_description']); | ||
$html .= '</div>'; | ||
$label = $label . $html; | ||
} | ||
|
||
return $label; | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
|
||
// theme helper tags | ||
$GLOBALS['TL_LANG']['tl_article']['pdir_th_tag'] = array('Theme Helper Tag', 'Bitte wählen Sie einen Theme Helper Tag um den Inhalt dieses Artikels als Insert Tag zu nutzen.'); | ||
|
||
// theme desc & license | ||
$GLOBALS['TL_LANG']['tl_theme']['pdir_th_description'] = array('Beschreibung', 'Die Theme Beschreibung wird durch die Theme Einstellungen vorgegeben.'); | ||
$GLOBALS['TL_LANG']['tl_theme']['pdir_th_license_domain'] = array('Theme lizensiert für', 'Dieser Theme wurde für diese Domain kostenpflichtig lizensiert.'); | ||
$GLOBALS['TL_LANG']['tl_theme']['pdir_th_license_text'] = ' // Copyright-Link darf nicht entfernt werden.'; | ||
$GLOBALS['TL_LANG']['tl_theme']['pdir_th_payed_license_text'] = ' // kostenpflichtig registriert für '; | ||
|
||
$GLOBALS['TL_LANG']['tl_theme']['buyTheme'] = 'Kostenpflichtige Lizenz kaufen.'; | ||
$GLOBALS['TL_LANG']['MSC']['buyThemeConfirm'] = 'Möchten Sie für diesen Theme eine kostenplichtige Lizenz erwerben?'; | ||
$GLOBALS['TL_LANG']['MSC']['buyThemeButtonTitle'] = 'Theme Lizenz kaufen'; | ||
|
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,14 @@ | ||
<?php | ||
|
||
// theme helper tags | ||
$GLOBALS['TL_LANG']['tl_article']['pdir_th_tag'] = array('Theme Helper Tag', 'Please select a theme helper tag to use content of this article as insert tag.'); | ||
|
||
// theme desc & license | ||
$GLOBALS['TL_LANG']['tl_theme']['pdir_th_description'] = array('Theme description', 'The theme description is provided by theme config.'); | ||
$GLOBALS['TL_LANG']['tl_theme']['pdir_th_license_domain'] = array('Theme license for', 'This theme has a paid license for this domain.'); | ||
$GLOBALS['TL_LANG']['tl_theme']['pdir_th_license_text'] = ' // leave copyright license'; | ||
$GLOBALS['TL_LANG']['tl_theme']['pdir_th_payed_license_text'] = ' // paid license for '; | ||
|
||
$GLOBALS['TL_LANG']['tl_theme']['buyTheme'] = 'Buy paid license.'; | ||
$GLOBALS['TL_LANG']['MSC']['buyThemeConfirm'] = 'Do you want to buy a paid license for this theme?'; | ||
$GLOBALS['TL_LANG']['MSC']['buyThemeButtonTitle'] = 'Buy theme license'; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.