Skip to content

Commit

Permalink
Merge remote-tracking branch 'fork-cms/master' into 5.3.0-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
carakas committed May 14, 2018
2 parents 11607b9 + bf8d800 commit 63b63ae
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 29 deletions.
18 changes: 6 additions & 12 deletions docs/05. module guide/06. blocks_and_widgets.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ The classname needs to be the exact same as the action name and the file name, i
/**
* The blogpost
*
* @vararray
* @var array
*/
private $record;
```

Then we define our (private) variables. In our case we'll use an array to save the record with the article we will be viewing.

```
public function execute()
public function execute(): void
{
// call the parent
parent::execute();
Expand Down Expand Up @@ -70,13 +70,7 @@ use Frontend\Modules\Tags\Engine\Model as FrontendTagsModel;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
...
/*
* Load the data
*
* @return void
*/
private function getData()
private function getData(): void
{
// if no parameter was passed we show the 404-page
if($this->url->getParameter(1) === null) {
Expand All @@ -101,13 +95,13 @@ The getData function first checks if the item given in the url exists and adds s
If an article was found, the data we fetched is parsed into the template-file.

```
private function parse()
private function parse(): void
{
$this->breadcrumb->addElement($this->record['title']);
$this->header->setPageTitle($this->record['title']);
$this->header->setMetaDescription($this->record['meta_description'] , $this->record['meta_description_overwrite']));
$this->header->setMetaKeywords($this->record['meta_keywords'] , $this->record['meta_keywords_overwrite']));
$this->header->setMetaDescription($this->record['meta_description'] , $this->record['meta_description_overwrite']);
$this->header->setMetaKeywords($this->record['meta_keywords'] , $this->record['meta_keywords_overwrite']);
$this->template->assign('item', $this->record);
$this->template->assign('navigation' , FrontendMiniBlogModel::getNavigation($this->record['id']));
Expand Down
12 changes: 10 additions & 2 deletions src/Backend/Modules/Analytics/Js/Analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
*/
/* global Highcharts */
jsBackend.analytics = {
$chartPieChart: $('#chartPieChart'),
$chartDoubleMetricPerDay: $('#chartDoubleMetricPerDay')
$chartPieChart: null,
$chartDoubleMetricPerDay: null
}

jsBackend.analytics.charts = {
init: function () {
jsBackend.analytics.$chartPieChart = $('#chartPieChart')
jsBackend.analytics.$chartDoubleMetricPerDay = $('#chartDoubleMetricPerDay')

if (jsBackend.analytics.$chartPieChart.length > 0 || jsBackend.analytics.$chartDoubleMetricPerDay.length > 0) {
Highcharts.setOptions({
colors: ['#2f77d1', '#021b45', '#ED561B', '#EDEF00', '#24CBE5', '#64E572', '#FF9655'],
Expand All @@ -24,6 +27,9 @@ jsBackend.analytics.charts = {
}
})
}

jsBackend.analytics.chartPieChart.init()
jsBackend.analytics.chartDoubleMetricPerDay.init()
}
}

Expand Down Expand Up @@ -180,3 +186,5 @@ jsBackend.analytics.chartDoubleMetricPerDay = {
jsBackend.analytics.chartDoubleMetricPerDay.chart.destroy()
}
}

$(jsBackend.analytics.charts.init)
4 changes: 1 addition & 3 deletions src/Backend/Modules/Extensions/Engine/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,7 @@ private static function getModulesThatRequireSetting(string $setting): array
return array_filter(
BackendModel::getModules(),
function (string $module) use ($moduleSettings, $setting): bool {
$requiresGoogleRecaptcha = $moduleSettings->get($module, 'requires_' . $setting, false);

return $requiresGoogleRecaptcha;
return $moduleSettings->get($module, 'requires_' . $setting, false);
}
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Backend/Modules/Locale/Layout/Templates/Edit.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<div class="btn-toolbar">
{% if showLocaleDelete %}
<div class="btn-group pull-left" role="group">
{{ macro.buttonIcon('', 'trash-o', 'lbl.Delete'|trans|ucfirst, 'btn-danger', {"type":"submit", "data-toggle":"modal", "data-target":"#confirmDelete"}) }}
{{ macro.buttonIcon('', 'trash-o', 'lbl.Delete'|trans|ucfirst, 'btn-danger', {"type":"button", "data-toggle":"modal", "data-target":"#confirmDelete"}) }}
</div>
{% endif %}
<div class="btn-group pull-right" role="group">
Expand Down
24 changes: 14 additions & 10 deletions src/Backend/Modules/Pages/Engine/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@ public static function copy(string $fromLanguage, string $toLanguage): void
// define old block ids
$contentBlockOldIds = array_keys($contentBlockIds);

// copy location widgets and get copied widget ids
$copyLocationWidgets = new CopyLocationWidgetsToOtherLocale($toLocale, $fromLocale);
$commandBus->handle($copyLocationWidgets);
$locationWidgetIds = $copyLocationWidgets->extraIdMap;

// define old block ids
$locationWidgetOldIds = array_keys($locationWidgetIds);
if (BackendModel::isModuleInstalled('Location')) {
// copy location widgets and get copied widget ids
$copyLocationWidgets = new CopyLocationWidgetsToOtherLocale($toLocale, $fromLocale);
$commandBus->handle($copyLocationWidgets);
$locationWidgetIds = $copyLocationWidgets->extraIdMap;

// define old block ids
$locationWidgetOldIds = array_keys($locationWidgetIds);
}

// get all old pages
$ids = $database->getColumn(
Expand Down Expand Up @@ -238,9 +240,11 @@ public static function copy(string $fromLanguage, string $toLanguage): void
$block['extra_id'] = $contentBlockIds[$block['extra_id']];
}

// Overwrite the extra_id of the old location widget with the id of the new one
if (in_array($block['extra_id'], $locationWidgetOldIds)) {
$block['extra_id'] = $locationWidgetIds[$block['extra_id']];
if (BackendModel::isModuleInstalled('Location')) {
// Overwrite the extra_id of the old location widget with the id of the new one
if (in_array($block['extra_id'], $locationWidgetOldIds)) {
$block['extra_id'] = $locationWidgetIds[$block['extra_id']];
}
}

// add block
Expand Down
3 changes: 2 additions & 1 deletion src/Frontend/Modules/FormBuilder/Widgets/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use Frontend\Modules\FormBuilder\FormBuilderEvents;
use Frontend\Modules\FormBuilder\Event\FormBuilderSubmittedEvent;
use ReCaptcha\ReCaptcha;
use ReCaptcha\RequestMethod\CurlPost;
use SpoonFormAttributes;
use Symfony\Component\HttpFoundation\RedirectResponse;

Expand Down Expand Up @@ -411,7 +412,7 @@ private function validateForm(): void
$this->form->addError(FL::err('RecaptchaInvalid'));
}

$recaptcha = new ReCaptcha($secret);
$recaptcha = new ReCaptcha($secret, new CurlPost());

$response = $recaptcha->verify($response);

Expand Down

0 comments on commit 63b63ae

Please sign in to comment.