Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 1.0.x
  • 2.0.x
  • add-unit-and-kernel-tests
  • plugin-injection
  • ui-improvements
  • 1.0.0
  • 1.0.0-alpha1
  • 1.0.0-alpha2
  • 1.0.0-alpha3
  • 1.0.0-alpha4
  • 1.0.0-alpha5
  • 1.0.0-beta
  • 1.0.1
  • 1.0.2
  • 1.0.3
  • 1.0.4
  • 1.0.5
  • 1.0.6
  • 1.0.7
  • 1.0.7-alpha1
  • 1.0.7-alpha2
  • 1.0.71
  • v1.0.0
  • v1.0.0-beta
24 results

Target

Select target project
  • issue/quiz_maker-3444754
  • issue/quiz_maker-3446497
  • issue/quiz_maker-3444173
  • project/quiz_maker
  • issue/quiz_maker-3443485
  • issue/quiz_maker-3452417
  • issue/quiz_maker-3452409
  • issue/quiz_maker-3456352
  • issue/quiz_maker-3456432
  • issue/quiz_maker-3465173
  • issue/quiz_maker-3447471
  • issue/quiz_maker-3468121
  • issue/quiz_maker-3475830
  • issue/quiz_maker-3486334
  • issue/quiz_maker-3486341
  • issue/quiz_maker-3492331
16 results
Select Git revision
  • 1.0.x
  • 2.0.x
  • 3492331-coding-standard-issues
  • plugin-injection
  • 1.0.0
  • 1.0.0-alpha1
  • 1.0.0-alpha2
  • 1.0.0-alpha3
  • 1.0.0-alpha4
  • 1.0.0-alpha5
  • 1.0.0-beta
  • 1.0.1
  • 1.0.2
  • 1.0.3
  • 1.0.4
  • 1.0.5
  • 1.0.6
  • 1.0.7
  • 1.0.7-alpha1
  • 1.0.7-alpha2
  • v1.0.0
  • v1.0.0-beta
22 results
Show changes
Commits on Source (2)
Showing
with 38 additions and 33 deletions
......@@ -7,7 +7,10 @@ include:
- '/includes/include.drupalci.workflows.yml'
variables:
_TARGET_CORE: "^9.5.3 || ^10.3 || ^11"
_CSPELL_IGNORE_PATHS: './config/*, ./css/*, ./icons/*, ./images/*, ./README.md'
_CSPELL_WORDS: 'langname, grumphp, perc, addtoany'
OPT_IN_TEST_NEXT_MAJOR: 0
\ No newline at end of file
OPT_IN_TEST_NEXT_MAJOR: 0
composer:
variables:
DRUPAL_CORE: ^9.5.3 || ^10.3 || ^11
......@@ -349,7 +349,7 @@ class Question extends RevisionableContentEntityBase implements QuestionInterfac
/**
* {@inheritDoc}
*/
public function getAnsweringForm(QuestionResponseInterface $question_response = NULL, bool $allow_change_response = TRUE): array {
public function getAnsweringForm(QuestionResponseInterface|null $question_response = NULL, bool $allow_change_response = TRUE): array {
return $this->getPluginInstance()->getAnsweringForm($question_response, $allow_change_response);
}
......
......@@ -217,7 +217,7 @@ class QuestionAnswer extends ContentEntityBase implements QuestionAnswerInterfac
/**
* {@inheritDoc}
*/
public function getAnswer(QuestionResponseInterface $response = NULL): ?string {
public function getAnswer(QuestionResponseInterface|null $response = NULL): ?string {
return $this->getPluginInstance()->getAnswer($response);
}
......
......@@ -278,7 +278,7 @@ class QuestionResponse extends ContentEntityBase implements QuestionResponseInte
/**
* {@inheritDoc}
*/
public function setScore(QuestionInterface $question, bool $value, float $score = NULL, array $response_data = []): QuestionResponseInterface {
public function setScore(QuestionInterface $question, bool $value, float|null $score = NULL, array $response_data = []): QuestionResponseInterface {
return $this->getPluginInstance()->setScore($question, $value, $score, $response_data);
}
......
......@@ -71,7 +71,7 @@ class QuizResultReviewForm extends FormBase {
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, QuizResultInterface $quiz_result = NULL): array {
public function buildForm(array $form, FormStateInterface $form_state, QuizResultInterface|null $quiz_result = NULL): array {
if ($quiz_result) {
$this->quizResult = $quiz_result;
......
......@@ -86,7 +86,7 @@ class QuizTakeForm extends FormBase {
/**
* {@inheritDoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, QuizInterface $quiz = NULL) {
public function buildForm(array $form, FormStateInterface $form_state, QuizInterface|null $quiz = NULL): array {
$form['question'] = [
'#type' => 'container',
......@@ -185,11 +185,12 @@ class QuizTakeForm extends FormBase {
'#type' => 'actions',
];
if ($this->quizSession->getCurrentQuestionNumber($quiz) < (count($questions) - 1)) {
$form['question']['navigation']['actions']['next'] = [
if ($this->quizSession->getCurrentQuestionNumber($quiz) > 0 && $quiz->allowBackwardNavigation()) {
$form['question']['navigation']['actions']['previous'] = [
'#type' => 'submit',
'#value' => $this->t('Next'),
'#submit' => ['::getNextQuestion'],
'#value' => $this->t('Previous'),
'#submit' => ['::getPreviousQuestion'],
'#weight' => 0,
'#ajax' => [
'callback' => '::updateQuestionForm',
'wrapper' => 'question',
......@@ -199,14 +200,16 @@ class QuizTakeForm extends FormBase {
'message' => $this->t('Go to the next question...'),
],
],
'#limit_validation_errors' => [],
];
}
if ($this->quizSession->getCurrentQuestionNumber($quiz) > 0 && $quiz->allowBackwardNavigation()) {
$form['question']['navigation']['actions']['previous'] = [
if ($this->quizSession->getCurrentQuestionNumber($quiz) < (count($questions) - 1)) {
$form['question']['navigation']['actions']['next'] = [
'#type' => 'submit',
'#value' => $this->t('Previous'),
'#submit' => ['::getPreviousQuestion'],
'#value' => $this->t('Next'),
'#submit' => ['::getNextQuestion'],
'#weight' => 1,
'#ajax' => [
'callback' => '::updateQuestionForm',
'wrapper' => 'question',
......@@ -216,7 +219,6 @@ class QuizTakeForm extends FormBase {
'message' => $this->t('Go to the next question...'),
],
],
'#limit_validation_errors' => [],
];
}
......@@ -258,7 +260,7 @@ class QuizTakeForm extends FormBase {
/**
* {@inheritDoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state, QuizInterface $quiz = NULL) {
public function submitForm(array &$form, FormStateInterface $form_state, QuizInterface|null $quiz = NULL): void {
$quiz = $this->getQuiz();
if ($quiz instanceof QuizInterface) {
$current_question = $this->quizSession->getCurrentQuestion($quiz);
......@@ -278,7 +280,7 @@ class QuizTakeForm extends FormBase {
$quiz = $this->getQuiz();
if ($quiz instanceof QuizInterface) {
/** @var \Drupal\quiz_maker\QuestionInterface $current_question */
$current_question = $this->quizSession->getCurrentQuestionNumber($quiz);
$current_question = $this->quizSession->getCurrentQuestion($quiz);
if (!$quiz->allowSkipping()) {
$current_question->validateAnsweringForm($form, $form_state);
}
......
......@@ -22,7 +22,7 @@ class DirectAnswer extends QuestionAnswerPluginBase {
/**
* {@inheritDoc}
*/
public function getAnswer(QuestionResponseInterface $response = NULL): ?string {
public function getAnswer(QuestionResponseInterface|null $response = NULL): ?string {
if ($response instanceof QuestionResponse && $response->getPluginInstance() instanceof DirectResponse) {
return $response->getPluginInstance()->getUserResponse() ?? $this->t('Empty answer');
}
......
......@@ -70,7 +70,7 @@ class MatchingAnswer extends QuestionAnswerPluginBase implements SimpleScoringAn
/**
* {@inheritDoc}
*/
public function getAnswer(QuestionResponseInterface $response = NULL): ?string {
public function getAnswer(QuestionResponseInterface|null $response = NULL): ?string {
$matching_question = $this->getMatchingQuestion();
if ($response) {
$chosen_matching_answer = $this->getChosenMatchingAnswer($response->getQuestion(), $response->getResponses());
......
......@@ -22,7 +22,7 @@ class BooleanQuestion extends QuestionPluginBase {
/**
* {@inheritDoc}
*/
public function getAnsweringForm(QuestionResponseInterface $question_response = NULL, bool $allow_change_response = TRUE): array {
public function getAnsweringForm(QuestionResponseInterface|null $question_response = NULL, bool $allow_change_response = TRUE): array {
$answers = $this->getEntity()->getAnswers();
if ($answers) {
$options = [];
......
......@@ -22,7 +22,7 @@ class DirectQuestion extends QuestionPluginBase {
/**
* {@inheritDoc}
*/
public function getAnsweringForm(QuestionResponseInterface $question_response = NULL, bool $allow_change_response = TRUE): array {
public function getAnsweringForm(QuestionResponseInterface|null $question_response = NULL, bool $allow_change_response = TRUE): array {
$default_answer = $question_response?->getResponses();
if ($default_answer) {
/** @var \Drupal\quiz_maker\QuestionAnswerInterface $default_value */
......
......@@ -26,7 +26,7 @@ class MatchingQuestion extends QuestionPluginBase implements SimpleScoringQuesti
/**
* {@inheritDoc}
*/
public function getAnsweringForm(QuestionResponseInterface $question_response = NULL, bool $allow_change_response = TRUE): array {
public function getAnsweringForm(QuestionResponseInterface|null $question_response = NULL, bool $allow_change_response = TRUE): array {
$answers = $this->getEntity()->getAnswers();
if ($answers) {
$answer_form = [
......
......@@ -26,7 +26,7 @@ class MultipleChoiceQuestion extends QuestionPluginBase implements SimpleScoring
/**
* {@inheritDoc}
*/
public function getAnsweringForm(QuestionResponseInterface $question_response = NULL, bool $allow_change_response = TRUE): array {
public function getAnsweringForm(QuestionResponseInterface|null $question_response = NULL, bool $allow_change_response = TRUE): array {
if ($answers = $this->getEntity()->getAnswers()) {
$options = [];
foreach ($answers as $answer) {
......
......@@ -22,7 +22,7 @@ class SingleChoiceQuestion extends QuestionPluginBase {
/**
* {@inheritDoc}
*/
public function getAnsweringForm(QuestionResponseInterface $question_response = NULL, bool $allow_change_response = TRUE): array {
public function getAnsweringForm(QuestionResponseInterface|null $question_response = NULL, bool $allow_change_response = TRUE): array {
if ($answers = $this->getEntity()->getAnswers()) {
$options = [];
foreach ($answers as $answer) {
......
......@@ -80,7 +80,7 @@ abstract class QuestionAnswerPluginBase extends PluginBase implements QuestionAn
/**
* {@inheritDoc}
*/
public function getAnswer(QuestionResponseInterface $response = NULL): ?string {
public function getAnswer(QuestionResponseInterface|null $response = NULL): ?string {
return $this->entity->get('answer')->value;
}
......
......@@ -85,7 +85,7 @@ abstract class QuestionResponsePluginBase extends PluginBase implements Question
/**
* {@inheritDoc}
*/
public function setScore(QuestionInterface $question, bool $value, float $score = NULL, array $response_data = []): QuestionResponseInterface {
public function setScore(QuestionInterface $question, bool $value, float|null $score = NULL, array $response_data = []): QuestionResponseInterface {
if ($value) {
$this->entity->set('score', $score ?? $question->getMaxScore());
}
......
......@@ -32,7 +32,7 @@ interface QuestionAnswerInterface {
* @return string|null
* The answer text or null.
*/
public function getAnswer(QuestionResponseInterface $response = NULL): ?string;
public function getAnswer(QuestionResponseInterface|null $response = NULL): ?string;
/**
* Get response status.
......
......@@ -48,7 +48,7 @@ interface QuestionInterface {
* @return array
* Form array.
*/
public function getAnsweringForm(QuestionResponseInterface $question_response = NULL, bool $allow_change_response = TRUE): array;
public function getAnsweringForm(QuestionResponseInterface|null $question_response = NULL, bool $allow_change_response = TRUE): array;
/**
* Question form validation.
......
......@@ -106,7 +106,7 @@ interface QuestionResponseInterface {
* @return \Drupal\quiz_maker\QuestionResponseInterface
* The response object.
*/
public function setScore(QuestionInterface $question, bool $value, float $score = NULL, array $response_data = []): QuestionResponseInterface;
public function setScore(QuestionInterface $question, bool $value, float|null $score = NULL, array $response_data = []): QuestionResponseInterface;
/**
* Set question response feedback.
......
......@@ -61,7 +61,7 @@ class QuizHelper {
* @return array
* The render array.
*/
public function getQuestionResultView(QuestionInterface $question, QuestionResponseInterface $response, int $mark_mode = 0, bool $show_score = TRUE, int $list_style = NULL): array {
public function getQuestionResultView(QuestionInterface $question, QuestionResponseInterface $response, int $mark_mode = 0, bool $show_score = TRUE, int|null $list_style = NULL): array {
$result_view = [
'#type' => 'container',
'#attributes' => [
......@@ -119,7 +119,7 @@ class QuizHelper {
* @return string
* Style.
*/
public function getListStyle(int $style = NULL): string {
public function getListStyle(int|null $style = NULL): string {
return match($style) {
0 => 'response-list-number-with-bracket',
2 => 'response-list-number-with-dot',
......
......@@ -68,7 +68,7 @@ class QuizResultManager {
* @return \Drupal\quiz_maker\QuizResultInterface|null
* The quiz result or null.
*/
public function createQuizResult(AccountInterface $user, QuizInterface $quiz, string $langcode, string $session_id = NULL): ?QuizResultInterface {
public function createQuizResult(AccountInterface $user, QuizInterface $quiz, string $langcode, string|null $session_id = NULL): ?QuizResultInterface {
$conditions = [
'state' => QuizResultType::DRAFT,
];
......