You are here

public function ReportController::close in Open Social 8.5

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_content_report/src/Controller/ReportController.php \Drupal\social_content_report\Controller\ReportController::close()
  2. 8.6 modules/social_features/social_content_report/src/Controller/ReportController.php \Drupal\social_content_report\Controller\ReportController::close()
  3. 8.7 modules/social_features/social_content_report/src/Controller/ReportController.php \Drupal\social_content_report\Controller\ReportController::close()
  4. 8.8 modules/social_features/social_content_report/src/Controller/ReportController.php \Drupal\social_content_report\Controller\ReportController::close()
  5. 10.3.x modules/social_features/social_content_report/src/Controller/ReportController.php \Drupal\social_content_report\Controller\ReportController::close()
  6. 10.0.x modules/social_features/social_content_report/src/Controller/ReportController.php \Drupal\social_content_report\Controller\ReportController::close()
  7. 10.1.x modules/social_features/social_content_report/src/Controller/ReportController.php \Drupal\social_content_report\Controller\ReportController::close()
  8. 10.2.x modules/social_features/social_content_report/src/Controller/ReportController.php \Drupal\social_content_report\Controller\ReportController::close()

Function for suggestions.

Parameters

\Drupal\flag\FlaggingInterface $flagging: The Flagging object to close.

Return value

\Symfony\Component\HttpFoundation\RedirectResponse A simple response.

Throws

\Drupal\Core\Entity\EntityStorageException

1 string reference to 'ReportController::close'
social_content_report.routing.yml in modules/social_features/social_content_report/social_content_report.routing.yml
modules/social_features/social_content_report/social_content_report.routing.yml

File

modules/social_features/social_content_report/src/Controller/ReportController.php, line 27

Class

ReportController
Class ReportController.

Namespace

Drupal\social_content_report\Controller

Code

public function close(FlaggingInterface $flagging) {
  if ($flagging
    ->hasField('field_status')) {

    // Disable the status field.
    $flagging
      ->set('field_status', 0);
    $flagging
      ->save();
  }
  return new RedirectResponse('view.report_overview.overview');
}