Skip to content

Commit

Permalink
Second release of the PR already submitted some weeks ago
Browse files Browse the repository at this point in the history
I am not allowed to force the property "position" of a rate item because I included, in its item setup form, the user item to allow course creators to choose the content position.
So I have to decide:
    I drop the user item to allow course creators to choose the content position
    I no longer force the property "position"

I choosed the second option.
  • Loading branch information
kordan committed Nov 28, 2024
1 parent b214dca commit faf15bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion classes/local/form/userform.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function definition() {
$itemname = $item->get_itemname().'_extrarow';
$content = $item->get_contentwithnumber();
$option = ['class' => 'indent-'.$item->get_indent()];
$mform->addElement('mod_surveypro_label', $itemname, $elementnumber, $content, $option);
$mform->addElement('mod_surveypro_label', $itemname, '', $content, $option);

$item->item_add_color_unifier($mform);
}
Expand Down
6 changes: 2 additions & 4 deletions field/rate/classes/item.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@ public function __construct($cm, $surveypro, $itemid, $getparentcontent) {

// List of fields I do not want to have in the item definition form.
$this->insetupform['insearchform'] = false;
$this->insetupform['position'] = SURVEYPRO_POSITIONLEFT;

if (!empty($itemid)) {
$this->item_load($itemid, $getparentcontent);
Expand Down Expand Up @@ -249,12 +248,11 @@ public function item_custom_fields_to_db($record) {
// Nothing to do: they don't exist in this plugin.

// 2. Override few values.
// Position and hideinstructions are set by design.
$record->position = SURVEYPRO_POSITIONTOP;
// Nothing to do: no need to overwrite variables.

// 3. Set values corresponding to checkboxes.
// Take care: 'required', 'hideinstructions' were already considered in get_common_settings.
$checkboxes = ['hideinstructions', 'differentrates'];
$checkboxes = ['differentrates'];
foreach ($checkboxes as $checkbox) {
$record->{$checkbox} = (isset($record->{$checkbox})) ? 1 : 0;
}
Expand Down

0 comments on commit faf15bc

Please sign in to comment.