[FEATURE] Use registered icon in frontend template 67/51167/2
authorStanislas Rolland <typo3@sjbr.ca>
Fri, 6 Jan 2017 19:43:57 +0000 (14:43 -0500)
committerStanislas Rolland <typo3@sjbr.ca>
Fri, 6 Jan 2017 19:45:39 +0000 (20:45 +0100)
Resolves: #79188
Change-Id: I853b19ea3b1dce583acd6e8710697e4d00a73ab2
Reviewed-on: https://review.typo3.org/51167
Reviewed-by: Stanislas Rolland <typo3@sjbr.ca>
Tested-by: Stanislas Rolland <typo3@sjbr.ca>
Resources/Private/Partials/Select.html
Resources/Public/StyleSheets/SrLanguageMenu.css
ext_localconf.php

index 1381e81..2c225dc 100644 (file)
@@ -1,8 +1,9 @@
+{namespace core=TYPO3\CMS\Core\ViewHelpers}\r
 <f:form action="redirect" id="sr_language_menu_form" class="tx-srlanguagemenu">\r
        <fieldset>\r
                <legend>{f:translate(key:'form_fieldset_legend')}</legend>\r
                <label for="sr_language_menu_select">{f:translate(key:'form_select_label')}</label>\r
-               <img src="{f:uri.resource(path: 'Images/language.png')}" class="tx-srlanguagemenu-language-icon" alt="{f:translate(key: 'select_language', extensionName: 'SrLanguageMenu')}" />\r
+               <core:icon identifier="tx-srlanguagemenu-language" size="small" state="default" />\r
                <select id="sr_language_menu_select" name="tx_srlanguagemenu_languagemenu[uri]" title="{f:translate(key: 'select_language', extensionName: 'SrLanguageMenu')}" {f:if(condition: '{settings.list.onChangeAttribute}', then: 'onchange="if (this.options[this.selectedIndex].value == \'\') return; location.href = this.options[this.selectedIndex].value;"')}>\r
                        <f:if condition="{settings.list.header}">\r
                                <option value ="">{f:translate(key:'select_language')}</option>\r
index d370067..b4bc7f5 100644 (file)
@@ -66,7 +66,8 @@
 .tx-srlanguagemenu fieldset label {
        display: none;
 }
-.tx-srlanguagemenu fieldset img.tx-srlanguagemenu-language-icon {
+.tx-srlanguagemenu fieldset span.icon-markup {
+       display: inline-block;
        margin-right: 3px;
        vertical-align: middle;
 }
index 0cc14f3..4ef3ce0 100644 (file)
@@ -18,14 +18,15 @@ defined('TYPO3_MODE') or die();
        \TYPO3\CMS\Extbase\Utility\ExtensionUtility::PLUGIN_TYPE_CONTENT_ELEMENT
 );
 
+// Register icon
+$iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
+$iconRegistry->registerIcon(
+  'tx-srlanguagemenu-language',
+  \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class,
+  ['source' => 'EXT:' . $_EXTKEY . '/Resources/Public/Images/language.png']
+);
+
 if (TYPO3_MODE === 'BE') {
        // Include page TS configuration for new element wizard
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig('<INCLUDE_TYPOSCRIPT: source="FILE:EXT:' . $_EXTKEY . '/Configuration/PageTS/modWizards.txt">');
-       // Register icon
-       $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class);
-       $iconRegistry->registerIcon(
-         'tx-srlanguagemenu-language',
-         \TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider::class,
-         ['source' => 'EXT:' . $_EXTKEY . '/Resources/Public/Images/language.png']
-       );
 }
\ No newline at end of file