Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide the member widget if searching protected sites is disabled #1291

Merged
merged 1 commit into from
Feb 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions core-bundle/src/Resources/contao/classes/Crawl.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,12 @@ public function run()
$factory = System::getContainer()->get('contao.crawl.escargot_factory');
$subscriberNames = $factory->getSubscriberNames();
$subscribersWidget = $this->generateSubscribersWidget($subscriberNames);
$memberWidget = $this->generateMemberWidget();
$memberWidget = null;

if (System::getContainer()->getParameter('contao.search.index_protected'))
{
$memberWidget = $this->generateMemberWidget();
}

$template = new BackendTemplate('be_crawl');
$template->isActive = $this->isActive();
Expand Down Expand Up @@ -102,7 +107,7 @@ public function run()
/** @var FrontendPreviewAuthenticator $objAuthenticator */
$objAuthenticator = System::getContainer()->get('contao.security.frontend_preview_authenticator');

if ($memberWidget->value)
if ($memberWidget && $memberWidget->value)
{
$objMember = Database::getInstance()->prepare('SELECT username FROM tl_member WHERE id=?')
->execute((int) $memberWidget->value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@
<p class="tl_help tl_tip"><?= $this->trans('tl_maintenance.crawlSubscribers.1') ?></p>
<?php endif; ?>
</div>
<div>
<?= $this->memberWidget->parse() ?>
<?php if (!$this->memberWidget->hasErrors()): ?>
<p class="tl_help tl_tip"><?= $this->trans('tl_maintenance.crawlMember.1') ?></p>
<?php endif; ?>
</div>
<?php if ($this->memberWidget): ?>
<div>
<?= $this->memberWidget->parse() ?>
<?php if (!$this->memberWidget->hasErrors()): ?>
<p class="tl_help tl_tip"><?= $this->trans('tl_maintenance.crawlMember.1') ?></p>
<?php endif; ?>
</div>
<?php endif; ?>
</div>
</div>
<div class="tl_submit_container">
Expand Down