Skip to content

Commit

Permalink
[FEATURE] add new content element Contacts Card (#253)
Browse files Browse the repository at this point in the history
* [FEATURE] add new content element Contacts Card

* [FEATURE] add styles for Contacts Card, fix template

* [FEATURE] change element description
  • Loading branch information
myroslav321 authored and dmh committed Sep 6, 2017
1 parent f364e3b commit 53e5546
Show file tree
Hide file tree
Showing 12 changed files with 331 additions and 1 deletion.
1 change: 1 addition & 0 deletions Configuration/ContentElements/ContentElements.pagets
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mod.wizards.newContentElement.wizardItems.contentElements {
socialIcons.tt_content_defValues.CType = socialIcons
contacts.tt_content_defValues.CType = contacts
copyrightText.tt_content_defValues.CType = copyrightText
contactsCard.tt_content_defValues.CType = contactsCard
}
}

11 changes: 11 additions & 0 deletions Configuration/ContentElements/contactsCard.pagets
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
mod.wizards.newContentElement.wizardItems.contentElements {
elements {
contactsCard {
title = LLL:EXT:theme_t3kit/Resources/Private/Language/ContentElements.xlf:contactsCard.title
description = LLL:EXT:theme_t3kit/Resources/Private/Language/ContentElements.xlf:contactsCard.description
iconIdentifier = content-elements-contactsCard
}
}
show := addToList(contactsCard)
}

27 changes: 27 additions & 0 deletions Configuration/ContentElements/contactsCard.setupts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
tt_content {
contactsCard =< lib.contentElement
contactsCard {
templateName = ContactsCard
dataProcessing {
10 = T3kit\themeT3kit\DataProcessing\FlexFormProcessor
10 {
fieldName = pi_flexform
as = settings
}
15 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor
15 {
references.fieldName = image
as = image
}
# "inherit" from lib.fluidContent
800 < lib.contentElement.dataProcessing.800
830 < lib.contentElement.dataProcessing.830
}
settings {
defaultImage = EXT:theme_t3kit/Resources/Public/Extensions/News/images/no_image.png
}
stdWrap {
editIcons = tt_content
}
}
}
62 changes: 62 additions & 0 deletions Configuration/FlexForms/flexform_contactsCard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<T3DataStructure>
<meta>
<langDisable>1</langDisable>
</meta>
<sheets>
<sDEF>
<ROOT>
<TCEforms>
<sheetTitle></sheetTitle>
</TCEforms>
<type>array</type>
<el>
<contactPhone_1>
<TCEforms>
<label>LLL:EXT:theme_t3kit/Resources/Private/Language/ContentElements.xlf:contactsCard.flexform.contactPhone_1</label>
<config>
<type>input</type>
<rows>1</rows>
</config>
</TCEforms>
</contactPhone_1>
<contactPhone_2>
<TCEforms>
<label>LLL:EXT:theme_t3kit/Resources/Private/Language/ContentElements.xlf:contactsCard.flexform.contactPhone_2</label>
<config>
<type>input</type>
<rows>1</rows>
</config>
</TCEforms>
</contactPhone_2>
<mobilePhone>
<TCEforms>
<label>LLL:EXT:theme_t3kit/Resources/Private/Language/ContentElements.xlf:contactsCard.flexform.mobilePhone</label>
<config>
<type>input</type>
<rows>1</rows>
</config>
</TCEforms>
</mobilePhone>
<email>
<TCEforms>
<label>LLL:EXT:theme_t3kit/Resources/Private/Language/ContentElements.xlf:contactsCard.flexform.email</label>
<config>
<type>input</type>
<rows>1</rows>
</config>
</TCEforms>
</email>
<linkedInLink>
<TCEforms>
<label>LLL:EXT:theme_t3kit/Resources/Private/Language/ContentElements.xlf:contactsCard.flexform.linkedInLink</label>
<config>
<type>input</type>
<rows>1</rows>
</config>
</TCEforms>
</linkedInLink>
</el>
</ROOT>
</sDEF>
</sheets>
</T3DataStructure>
39 changes: 39 additions & 0 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,45 @@
// ======================= divider [end] ==========================================


// ======================= contactCard [begin] ==========================================
// contactCard CType
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTcaSelectItem(
'tt_content',
'CType',
[
$contentElementLanguageFilePrefix . 'contactsCard.title',
'contactsCard',
'content-elements-contactsCard'
],
'copyrightText',
'after'
);
$GLOBALS['TCA']['tt_content']['ctrl']['typeicon_classes']['contactsCard'] = 'content-elements-contactsCard';

// contactsCard backend fields
$GLOBALS['TCA']['tt_content']['types']['contactsCard'] = [
'showitem' => '
--div--;' . $coreLanguageFilePrefix .'general,
--palette--;' . $frontendLanguageFilePrefix . 'palette.general;general,
header;' . $contentElementLanguageFilePrefix . 'contactsCard.name,
--linebreak--,subheader;' . $contentElementLanguageFilePrefix . 'contactsCard.job,
--linebreak--,pi_flexform;' . $contentElementLanguageFilePrefix . 'tt_content.tabs.settings,
--div--;' . $frontendLanguageFilePrefix . 'tabs.images,image,
--palette--;' . $contentElementLanguageFilePrefix . 'tt_content.palette.imageSize;imageSize,
--div--;' . $frontendLanguageFilePrefix . 'tabs.appearance,
--palette--;' . $frontendLanguageFilePrefix . 'palette.frames;frames,
--palette--;' . $frontendLanguageFilePrefix . 'palette.appearanceLinks;appearanceLinks,
--div--;' . $coreLanguageFilePrefix .'extended,
'
];

// contactsCard flexform
$GLOBALS['TCA']['tt_content']['columns']['pi_flexform']['config']['ds']['*,contactsCard'] = $flexformPath . 'flexform_contactsCard.xml';
// ======================= contactCard [end] ==========================================



//
// Palettes
Expand Down
8 changes: 8 additions & 0 deletions Configuration/TypoScript/Library/locallang.setupts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ plugin.tx_themes {
emailUs_label = Email us at
search_label = Search
search_placeholder = Search...
phone_label = TEL
email_label = EMAIL
}
sv {
languageMenu_label = Välj språk
Expand All @@ -23,6 +25,8 @@ plugin.tx_themes {
emailUs_label = E-post
search_label = Sök
search_placeholder = Sök...
phone_label = TEL
email_label = EMAIL
}
de {
languageMenu_label = Wähle deine Sprache aus
Expand All @@ -35,6 +39,8 @@ plugin.tx_themes {
emailUs_label = Email an
search_label = Suche
search_placeholder = Suche...
phone_label = TEL
email_label = EMAIL
}
da {
languageMenu_label = Vælg sprog
Expand All @@ -47,6 +53,8 @@ plugin.tx_themes {
emailUs_label = E-post til
search_label = Søg
search_placeholder = Søg...
phone_label = TEL
email_label = EMAIL
}
}
}
Expand Down
29 changes: 29 additions & 0 deletions Resources/Private/Language/ContentElements.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,35 @@
<source>Contact info element</source>
</trans-unit>

<!--Contacts Card-->
<trans-unit id="contactsCard.title">
<source>Contacts Card</source>
</trans-unit>
<trans-unit id="contactsCard.description">
<source>Photo and contact information</source>
</trans-unit>
<trans-unit id="contactsCard.name">
<source>Full Name</source>
</trans-unit>
<trans-unit id="contactsCard.job">
<source>Job Description</source>
</trans-unit>
<trans-unit id="contactsCard.flexform.contactPhone_1">
<source>Contact Phone 1</source>
</trans-unit>
<trans-unit id="contactsCard.flexform.contactPhone_2">
<source>Contact Phone 2</source>
</trans-unit>
<trans-unit id="contactsCard.flexform.mobilePhone">
<source>Mobile Phone</source>
</trans-unit>
<trans-unit id="contactsCard.flexform.email">
<source>E-mail</source>
</trans-unit>
<trans-unit id="contactsCard.flexform.linkedInLink">
<source>Link to LinkedIn Profile</source>
</trans-unit>

<!--Button Element-->
<trans-unit id="button.title">
<source>Button</source>
Expand Down
67 changes: 67 additions & 0 deletions Resources/Private/Templates/ContentElements/ContactsCard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">

<f:layout name="Default" />
<f:section name="Header" />
<f:section name="Main">
<!-- theme_t3kit: Templates/ContentElements/ContactsCard.html [begin] -->
<div class="contacts-card">
<div class="contacts-card__photo">
<f:if condition="{image}">
<f:then>
<f:for each="{image}" as="image" iteration="imageIteration">
<f:if condition="{imageIteration.isFirst}">
<f:image class="img-responsive contacts-card__contacts-photo" image="{image}" maxWidth="{settings.defaultWidth}" cropVariant="default" />
</f:if>
</f:for>
</f:then>
<f:else>
<f:image src="{settings.defaultImage}" class="img-responsive contacts-card__contacts-photo"/>
</f:else>
</f:if>
</div>
<div class="contacts-card__contacts">
<f:if condition="{data.header}">
<h3 class="contacts-card__contact-name">{data.header}</h3>
</f:if>
<f:if condition="{data.subheader}">
<p class="contacts-card__contact-job">{data.subheader}</p>
</f:if>
<f:if condition="{settings.contactPhone_1}">
<div class="contacts-card__contact-phone-wrp">
<span class="icons icon-t3-mobile"></span><f:translate key="phone_label"></f:translate>
<p class="contacts-card__contact-phone">{settings.contactPhone_1}</p>
</div>
</f:if>
<f:if condition="{settings.contactPhone_2}">
<div class="contacts-card__contact-phone-wrp">
<span class="icons icon-t3-mobile"></span><f:translate key="phone_label"></f:translate>
<p class="contacts-card__contact-phone">{settings.contactPhone_2}</p>
</div>
</f:if>
<f:if condition="{settings.mobilePhone}">
<div class="contacts-card__contact-phone-wrp">
<span class="icons icon-smartphone"></span><f:translate key="phone_label"></f:translate>
<p class="contacts-card__contact-phone">{settings.mobilePhone}</p>
</div>
</f:if>
<f:if condition="{settings.email}">
<div class="contacts-card__contact-email-wrp">
<span class="icons icon-t3-mail"></span><f:translate key="email_label"></f:translate>
<f:link.email email="{settings.email}" class="contacts-card__contact-email" title="{settings.email}">{settings.email}
</f:link.email>
</div>
</f:if>
<f:if condition="{settings.linkedInLink}">
<div class="contacts-card__contact-linkedin-wrp">
<span class="icons icon-t3-linkedin"></span>
<f:link.external uri="{settings.linkedInLink}" class="contacts-card__contact-linkedin" defaultScheme="https" target="_blank">{settings.linkedInLink}
</f:link.external>
</div>
</f:if>
</div>
</div>

<!-- theme_t3kit: Templates/ContentElements/ContactsCard.html [end] -->
</f:section>

</html>
22 changes: 22 additions & 0 deletions Resources/Public/Icons/ContentElements/contactsCard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion ext_tables.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
'content-elements-copyrightText' => 'copyrightText.svg',
'content-elements-contacts' => 'contacts.svg',
'content-elements-button' => 'button.svg',
'content-elements-heroImage' => 'heroImage.svg'
'content-elements-heroImage' => 'heroImage.svg',
'content-elements-contactsCard' => 'contactsCard.svg'
];
foreach ($contentElementIcons as $identifier => $contentElementIcon) {
$iconRegistry->registerIcon(
Expand Down
1 change: 1 addition & 0 deletions felayout_t3kit/dev/styles/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
@import "main/contentElements/sliderContainer.less";
@import "main/contentElements/simpleAccordion.less";
@import "main/contentElements/heroImage.less";
@import "main/contentElements/contactsCard.less";

// ========================
// appearance wrappers
Expand Down
Loading

0 comments on commit 53e5546

Please sign in to comment.