public function FaqAskController::askAnswerEditSettings in FAQ_Ask 8
This function is called when an expert selects a question to answer.
It changes the status option to "published" then goes to the regular FAQ edit function.
1 string reference to 'FaqAskController::askAnswerEditSettings'
File
- src/
Controller/ FaqAskController.php, line 92 - Contains \Drupal\faq\Controller\FaqAskController.
Class
- FaqAskController
- Controller routines for FAQ Ask routes.
Namespace
Drupal\faq_ask\ControllerCode
public function askAnswerEditSettings($nid) {
// Node object.
$node = node_load($nid);
if ($node
->get('status')->value == 1) {
drupal_set_message($this
->t('That question has already been answered.'), 'status');
}
else {
if (node_access('update', $node)) {
// Log in first.
$path = URL::fromUserInput('/node/' . $node
->get('nid')->value . '/edit', array(
'query' => array(
'ask' => 'TRUE',
),
))
->toString();
return new RedirectResponse($path);
}
else {
drupal_set_message($this
->t('You are not allowed to edit that question.'), 'error');
}
}
return new RedirectResponse(URL::fromUserInput('/node')
->toString());
}