-
Notifications
You must be signed in to change notification settings - Fork 4
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 #1 from lukaszuznanski/TASK/Initial-commit
[TASK] Initial commit
- Loading branch information
Showing
19 changed files
with
332 additions
and
340 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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
defined('TYPO3_MODE') || die(); | ||
|
||
call_user_func(function () { | ||
/** | ||
* Default TypoScript for Headless Solr | ||
*/ | ||
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile( | ||
'headless_solr', | ||
'Configuration/TypoScript', | ||
'Headless Solr' | ||
); | ||
}); |
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,7 @@ | ||
plugin.tx_solr { | ||
view { | ||
templateRootPath = EXT:headless_solr/Resources/Private/Solr/Templates/ | ||
partialRootPath = EXT:headless_solr/Resources/Private/Solr/Partials/ | ||
layoutRootPath = EXT:headless_solr/Resources/Private/Solr/Layouts/ | ||
} | ||
} |
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,31 @@ | ||
tt_content.list =< lib.contentElementWithHeader | ||
tt_content.list { | ||
fields { | ||
content { | ||
fields { | ||
data = CASE | ||
data { | ||
key.field = list_type | ||
|
||
solr_pi_results = USER | ||
solr_pi_results { | ||
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run | ||
vendorName = ApacheSolrForTypo3 | ||
extensionName = Solr | ||
settings < plugin.tx_solr.settings | ||
persistence < plugin.tx_solr.persistence | ||
view < plugin.tx_solr.view | ||
pluginName = pi_results | ||
switchableControllerActions { | ||
Search { | ||
1 = results | ||
2 = form | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1 +1,25 @@ | ||
# headless_solr | ||
# TYPO3 Extension "headless_solr" - Provides fluid templates to render proper JSON from EXT:solr | ||
This extension provides integration to headless extension with solr extension. | ||
|
||
If you have any questions just drop a line in #initiative-pwa Slack channel. | ||
|
||
## Requirements | ||
Extension requires TYPO3 in version at least 9.5. | ||
|
||
## Installation | ||
Install extension using composer\ | ||
``composer require friendsoftypo3/headless_solr`` | ||
|
||
and then, include Typoscript template, and you are ready to go. | ||
|
||
## Development | ||
Development for this extension is happening as part of the TYPO3 PWA initiative, see https://typo3.org/community/teams/typo3-development/initiatives/pwa/ | ||
|
||
## Credits | ||
|
||
A special thanks goes to [macopedia.com](https://macopedia.com) company, which is sponsoring development of this solution. | ||
|
||
### Developers involved in the project | ||
|
||
- Łukasz Uznański (Macopedia) | ||
- Adam Marcinkowski (Macopedia) |
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 @@ | ||
<f:render section="content" /> |
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 @@ | ||
<f:render section="content" /> |
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,43 @@ | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" | ||
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers" | ||
xmlns:s="http://typo3.org/ns/ApacheSolrForTypo3/Solr/ViewHelpers/"> | ||
|
||
<f:section name="Document"> | ||
<f:spaceless> | ||
<f:if condition="{resultSet.hasSearched}"> | ||
{"pagination": <s:widget.resultPaginate resultSet="{resultSet}"> | ||
,"list": { | ||
"count": {resultSet.searchResults -> f:count()} | ||
,"results": [<f:for each="{resultSet.searchResults}" as="searchResult" iteration="iterator"> | ||
<f:format.raw> | ||
<f:format.json value="{ | ||
uid: searchResult.fields.uid, | ||
pid: searchResult.fields.pid, | ||
typeNum: searchResult.fields.typeNum, | ||
site: searchResult.fields.site, | ||
type: searchResult.fields.type, | ||
searchType: searchResult.searchType_stringS, | ||
title: searchResult.fields.title, | ||
titleExact: searchResult.fields.titleExact, | ||
subTitle: searchResult.fields.subTitle, | ||
navTitle: searchResult.fields.navTitle, | ||
author: searchResult.fields.author, | ||
content: searchResult.fields.content, | ||
contentExact: searchResult.fields.contentExact, | ||
teaser: searchResult.fields.teaser, | ||
form: searchResult.fields.form_textExactS, | ||
ingredients: searchResult.fields.ingredients_textExactS, | ||
dosing: searchResult.fields.dosing_textExactS, | ||
responsible: searchResult.fields.responsible_textExactS, | ||
warnings: searchResult.fields.warnings_textExactS, | ||
purpose: searchResult.fields.purpose_textExactS, | ||
url: '{searchResult.fields.url -> headless:format.json.decode()}', | ||
image: '{searchResult.fields.image_stringM.0 -> headless:format.json.decode()}' | ||
}"/> | ||
</f:format.raw> | ||
{f:if(condition: iterator.isLast, else: ',')} | ||
</f:for>]} | ||
</s:widget.resultPaginate>} | ||
</f:if> | ||
</f:spaceless> | ||
</f:section> |
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,18 @@ | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" | ||
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers" | ||
xmlns:s="http://typo3.org/ns/ApacheSolrForTypo3/Solr/ViewHelpers"> | ||
|
||
<f:section name="PerPage"> | ||
<f:spaceless> | ||
[<f:for each="{resultSet.usedSearchRequest.contextTypoScriptConfiguration.searchResultsPerPageSwitchOptionsAsArray}" as="availablePerPage" iteration="iterator"> | ||
<f:format.raw> | ||
<f:format.json value="{ | ||
currentSearch: '{s:uri.search.currentSearch()}', | ||
usedResultsPerPage: resultSet.usedResultsPerPage, | ||
availablePerPage: availablePerPage | ||
}"/> | ||
</f:format.raw> | ||
{f:if(condition: iterator.isLast, else: ',')} | ||
</f:for>] | ||
</f:spaceless> | ||
</f:section> |
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,39 @@ | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" | ||
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers" | ||
xmlns:s="http://typo3.org/ns/ApacheSolrForTypo3/Solr/ViewHelpers"> | ||
|
||
<f:section name="Sorting"> | ||
<f:for each="{resultSet.sortings}" as="sorting"> | ||
|
||
<f:if condition="{sorting.isResetOption}"> | ||
<f:then> | ||
<li> | ||
<a href="{s:uri.sorting.removeSorting()}" class="solr-ajaxified">{sorting.label}</a> | ||
</li> | ||
</f:then> | ||
|
||
<f:else> | ||
<f:if condition="{sorting.selected}"> | ||
<f:then> | ||
<li class="active"> | ||
<a href="{s:uri.sorting.setSorting(sortingName: sorting.name, sortingDirection: sorting.oppositeDirection)}" class="solr-ajaxified"> | ||
<f:if condition="{sorting.isAscDirection}"> | ||
<f:then><span class=" glyphicon glyphicon-arrow-up pull-right"></span></f:then> | ||
<f:else><span class=" glyphicon glyphicon-arrow-down pull-right"></span></f:else> | ||
</f:if> | ||
<span>{sorting.label}</span> | ||
|
||
</a> | ||
</li> | ||
</f:then> | ||
<f:else> | ||
<li> | ||
<a href="{s:uri.sorting.setSorting(sortingName: sorting.name, sortingDirection: sorting.direction)}" class="solr-ajaxified">{sorting.label}</a> | ||
</li> | ||
</f:else> | ||
</f:if> | ||
</f:else> | ||
</f:if> | ||
|
||
</f:for> | ||
</f:section> |
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,16 @@ | ||
<f:section name="Form"> | ||
<f:spaceless> | ||
<f:format.raw> | ||
<f:format.json value="{ | ||
additionalFilters: additionalFilters, | ||
existingParameters: existingParameters, | ||
pluginNamespace: pluginNamespace, | ||
name: name, | ||
value: value, | ||
pageUid: pageUid, | ||
languageUid: languageUid, | ||
query: q | ||
}"/> | ||
</f:format.raw> | ||
</f:spaceless> | ||
</f:section> |
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,16 @@ | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" | ||
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers" | ||
xmlns:s="http://typo3.org/ns/ApacheSolrForTypo3/Solr/ViewHelpers/"> | ||
<f:layout name="Fullwidth"/> | ||
<f:section name="content"> | ||
<f:spaceless> | ||
<f:format.raw> | ||
[<f:format.json value="{ | ||
document: document, | ||
title: document.title, | ||
content: document.content, | ||
url: document.url | ||
}"/>] | ||
</f:format.raw> | ||
</f:spaceless> | ||
</f:section> |
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,9 @@ | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" | ||
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers" | ||
xmlns:s="http://typo3.org/ns/ApacheSolrForTypo3/Solr/ViewHelpers/"> | ||
|
||
<f:layout name="Fullwidth"/> | ||
|
||
<f:section name="content"> | ||
<f:render partial="Search/Form" section="Form" arguments="{search:search, additionalFilters:additionalFilters, pluginNamespace:pluginNamespace}" /> | ||
</f:section> |
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,20 @@ | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" | ||
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers" | ||
xmlns:s="http://typo3.org/ns/ApacheSolrForTypo3/Solr/ViewHelpers"> | ||
|
||
<f:layout name="Split"/> | ||
|
||
<f:section name="content"> | ||
<f:spaceless> | ||
<f:format.raw> | ||
<f:format.json value="{ | ||
form: '{f:render(partial: \'Search/Form\', section: \'Form\', arguments: \'{search:search, additionalFilters:additionalFilters, pluginNamespace: pluginNamespace, resultSet: resultSet}\') -> headless:format.json.decode()}', | ||
documents: '{f:render(partial: \'Result/Document\', section: \'Document\', arguments: \'{resultSet:resultSet}\') -> headless:format.json.decode()}', | ||
resultPerPage: '{f:render(partial: \'Result/PerPage\', section: \'PerPage\', arguments: \'{resultSet:resultSet}\') -> headless:format.json.decode()}', | ||
allResultCount: resultSet.allResultCount, | ||
currentSearch: '{s:uri.search.currentSearch()}', | ||
arguments: arguments.q | ||
}"/> | ||
</f:format.raw> | ||
</f:spaceless> | ||
</f:section> |
5 changes: 5 additions & 0 deletions
5
Resources/Private/Solr/Templates/Search/SolrNotAvailable.html
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,5 @@ | ||
<f:spaceless> | ||
<f:format.raw> | ||
<f:format.json value="Search is currently not available"/> | ||
</f:format.raw> | ||
</f:spaceless> |
9 changes: 9 additions & 0 deletions
9
Resources/Private/Solr/Templates/ViewHelpers/Widget/ResultPaginate/Index.html
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,9 @@ | ||
<f:spaceless> | ||
<f:format.raw> | ||
<f:format.json value="{ | ||
current: contentArguments.pagination.current, | ||
numberOfPages: contentArguments.pagination.numberOfPages | ||
}"/> | ||
</f:format.raw> | ||
</f:spaceless> | ||
<f:renderChildren arguments="{contentArguments}" /> |
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 @@ | ||
{ | ||
"name": "friendsoftypo3/headless_solr", | ||
"type": "typo3-cms-extension", | ||
"description": "This extension provides integration with solr to output content from TYPO3 in JSON format.", | ||
"keywords": [ | ||
"TYPO3", | ||
"headless", | ||
"pwa", | ||
"json", | ||
"solr" | ||
], | ||
"license": [ | ||
"GPL-2.0-or-later" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Tymoteusz Motylewski", | ||
"role": "Head" | ||
}, | ||
{ | ||
"name": "Łukasz Uznański", | ||
"role": "Developer" | ||
}, | ||
{ | ||
"name": "TYPO3 PWA Initiative", | ||
"role": "Developer", | ||
"email": "extensions@macopedia.com" | ||
} | ||
], | ||
"require": { | ||
"typo3/cms-core": "^9.5 || ^10.0" | ||
}, | ||
"suggest": { | ||
"friendsoftypo3/headless": "^2.0" | ||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
$EM_CONF[$_EXTKEY] = [ | ||
'title' => 'Headless Solr', | ||
'description' => 'This extension provides integration with solr to output content from TYPO3 in JSON format.', | ||
'state' => 'beta', | ||
'author' => 'Łukasz Uznański', | ||
'author_email' => 'extensions@macopedia.com', | ||
'category' => 'fe', | ||
'internal' => '', | ||
'version' => '1.0.0', | ||
'constraints' => [ | ||
'depends' => [ | ||
'typo3' => '9.5.0-10.0.99', | ||
'frontend' => '9.5.0-10.0.99' | ||
], | ||
'conflicts' => [], | ||
'suggests' => [ | ||
'headless' => '2.0.0-2.9.9' | ||
] | ||
], | ||
]; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.