Skip to content

Commit

Permalink
show NoIndexNotificationField/message just on objects
Browse files Browse the repository at this point in the history
  • Loading branch information
lerni authored Jan 7, 2022
1 parent 8e320e9 commit b02b695
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Extensions/IndexFormFileExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function updateFormFields(FieldList $fields, $controller, $formName, $con
{
$editorTab = $fields->findTab('Editor.Details');
$record = isset($context['Record']) ? $context['Record'] : null;
if ($editorTab && $record->NoFileIndex()->ID != 0) {
if ($editorTab && is_object($record->NoFileIndex())) {
$message = _t('Kraftausdruck\Extensions\IndexFormFileExtension.NoindexNotification', 'Indexing disabled per parent folder ({parent})!', ['parent' => $record->NoFileIndex()->Title]);
$NoIndexNotificationField = LiteralField::create('X-Robots-Tag', '<p class="alert alert-warning">' . $message . '</p>');
$fields->insertBefore('Title', $NoIndexNotificationField);
Expand Down

0 comments on commit b02b695

Please sign in to comment.