Skip to content

Commit

Permalink
FIX Update HTML markup for bootstrap 5
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Jan 15, 2025
1 parent aa7b9ca commit 8689f17
Show file tree
Hide file tree
Showing 19 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions src/Forms/GridField/GridFieldDetailForm_ItemRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,11 +352,11 @@ protected function getCreateContext()
protected function getRightGroupField()
{
$rightGroup = CompositeField::create()->setName('RightGroup');
$rightGroup->addExtraClass('ml-auto');
$rightGroup->addExtraClass('ms-auto');
$rightGroup->setFieldHolderTemplate(get_class($rightGroup) . '_holder_buttongroup');

$previousAndNextGroup = CompositeField::create()->setName('PreviousAndNextGroup');
$previousAndNextGroup->addExtraClass('btn-group--circular mr-2');
$previousAndNextGroup->addExtraClass('btn-group--circular me-2');
$previousAndNextGroup->setFieldHolderTemplate(CompositeField::class . '_holder_buttongroup');

$component = $this->gridField->getConfig()->getComponentByType(GridFieldDetailForm::class);
Expand Down
4 changes: 2 additions & 2 deletions src/Security/PermissionCheckboxSetField.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,15 @@ public function Field($properties = [])
$options .= "<li class=\"$extraClass\">"
. "<input id=\"$itemID\"$disabled name=\"$this->name[$code]\" type=\"checkbox\""
. " value=\"$code\"$checked class=\"checkbox\" />"
. "<label {$title}for=\"$itemID\">"
. "<label class=\"form-label\" {$title}for=\"$itemID\">"
. "<span class=\"font-icon-$icon\"></span>"
. "{$value}{$inheritMessage}</label>"
. "</li>\n";
} else {
$options .= "<li class=\"$extraClass\">"
. "<input id=\"$itemID\"$disabled name=\"$this->name[$code]\" type=\"checkbox\""
. " value=\"$code\"$checked class=\"checkbox\" />"
. "<label {$title}for=\"$itemID\">{$value}{$inheritMessage}</label>"
. "<label class=\"form-label\" {$title}for=\"$itemID\">{$value}{$inheritMessage}</label>"
. "</li>\n";
}
}
Expand Down
2 changes: 1 addition & 1 deletion templates/RightLabelledFieldHolder.ss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p id="$Name" class="field $Type">
$Field
<label class="right" for="$id">$Title</label>
<label class="form-label right" for="$id">$Title</label>
<% if $Message %><span class="message $MessageType">$Message</span><% end_if %>
</p>
2 changes: 1 addition & 1 deletion templates/SilverStripe/Forms/CheckboxField_holder.ss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<div id="$HolderID" class="field<% if extraClass %> $extraClass<% end_if %>">
$Field
<label class="right" for="$ID">$Title<% if $RightTitle %> $RightTitle<% end_if %></label>
<label class="form-label right" for="$ID">$Title<% if $RightTitle %> $RightTitle<% end_if %></label>
<% if $Message %><span class="message $MessageType">$Message</span><% end_if %>
<% if $Description %><span class="description">$Description</span><% end_if %>
</div>
2 changes: 1 addition & 1 deletion templates/SilverStripe/Forms/CheckboxField_holder_small.ss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
$Field

<% if $Title %>
<label class="checkboxfield-small" <% if $ID %>for="$ID"<% end_if %>>$Title<% if $RightTitle %> $RightTitle<% end_if %></label>
<label class="form-label checkboxfield-small" <% if $ID %>for="$ID"<% end_if %>>$Title<% if $RightTitle %> $RightTitle<% end_if %></label>
<% end_if %>
2 changes: 1 addition & 1 deletion templates/SilverStripe/Forms/CheckboxSetField.ss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% loop $Options %>
<li class="$Class" role="$Role">
<input id="$ID" class="checkbox" name="$Name" type="checkbox" value="$Value.ATT"<% if $isChecked %> checked="checked"<% end_if %><% if $isDisabled %> disabled="disabled"<% end_if %> />
<label for="$ID">$Title</label>
<label class="form-label" for="$ID">$Title</label>
</li>
<% end_loop %>
<% else %>
Expand Down
4 changes: 2 additions & 2 deletions templates/SilverStripe/Forms/FieldGroup_holder.ss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div <% if $Name %>id="$Name"<% end_if %> class="field <% if $extraClass %>$extraClass<% end_if %>">
<% if $Title %><label class="left">$Title</label><% end_if %>
<% if $Title %><label class="form-label left">$Title</label><% end_if %>

<div class="middleColumn fieldgroup<% if $Zebra %> fieldgroup-$Zebra<% end_if %>">
<% loop $FieldList %>
Expand All @@ -8,7 +8,7 @@
</div>
<% end_loop %>
</div>
<% if $RightTitle %><label class="right">$RightTitle</label><% end_if %>
<% if $RightTitle %><label class="form-label right">$RightTitle</label><% end_if %>
<% if $Message %><span class="message $MessageType">$Message</span><% end_if %>
<% if $Description %><span class="description">$Description</span><% end_if %>
</div>
4 changes: 2 additions & 2 deletions templates/SilverStripe/Forms/FormField_holder.ss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<div id="$HolderID" class="field<% if $extraClass %> $extraClass<% end_if %>">
<% if $Title %><label class="left" for="$ID">$Title</label><% end_if %>
<% if $Title %><label class="form-label left" for="$ID">$Title</label><% end_if %>
<div class="middleColumn">
$Field
</div>
<% if $RightTitle %><label class="right" for="$ID">$RightTitle</label><% end_if %>
<% if $RightTitle %><label class="form-label right" for="$ID">$RightTitle</label><% end_if %>
<% if $Message %><span class="message $MessageType">$Message</span><% end_if %>
<% if $Description %><span class="description">$Description</span><% end_if %>
</div>
4 changes: 2 additions & 2 deletions templates/SilverStripe/Forms/FormField_holder_small.ss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="fieldholder-small<% if $extraClass %> $extraClass<% end_if %>" id="$HolderID.ATT">
<% if $Title %><label class="fieldholder-small-label" <% if $ID %>for="$ID"<% end_if %>>$Title</label><% end_if %>
<% if $Title %><label class="form-label fieldholder-small-label" <% if $ID %>for="$ID"<% end_if %>>$Title</label><% end_if %>
$Field
<% if $RightTitle %><label class="right fieldholder-small-label" <% if $ID %>for="$ID"<% end_if %>>$RightTitle</label><% end_if %>
<% if $RightTitle %><label class="form-label right fieldholder-small-label" <% if $ID %>for="$ID"<% end_if %>>$RightTitle</label><% end_if %>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
class="grid-field__icon-action {$ExtraClass} action action-detail edit-link"
href="$Link" title="<%t SilverStripe\\Forms\\GridField\\GridFieldEditButton.EDIT 'Edit' %>"
>
<span class="sr-only"><%t SilverStripe\\Forms\\GridField\\GridFieldEditButton.EDIT 'Edit' %></span>
<span class="visually-hidden"><%t SilverStripe\\Forms\\GridField\\GridFieldEditButton.EDIT 'Edit' %></span>
</a>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<% if $ImportModalTitle %>
<h2 class="modal-title">$ImportModalTitle</h2>
<% end_if %>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<button type="button" class="btn-close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<a class="grid-field__icon-action font-icon-right-open btn--icon-large action action-detail view-link action-menu--handled" href="$Link">
<span class="sr-only">View</span>
<span class="visually-hidden">View</span>
</a>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>

<div class="ss-uploadfield-item-info">
<label class="ss-uploadfield-item-name">
<label class="form-label ss-uploadfield-item-name">
<span class="name" title="$Name">
$Name
</span>
Expand Down
2 changes: 1 addition & 1 deletion templates/SilverStripe/Forms/LabelField.ss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<label id="$ID" class="$extraClass">$Title</label>
<label id="$ID" class="form-label $extraClass">$Title</label>
2 changes: 1 addition & 1 deletion templates/SilverStripe/Forms/OptionsetField.ss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<% loop $Options %>
<li class="$Class" role="$Role">
<input id="$ID" class="radio" name="$Name" type="radio" value="$Value"<% if $isChecked %> checked<% end_if %><% if $isDisabled %> disabled<% end_if %> <% if $Up.Required %>required<% end_if %> />
<label for="$ID">$Title</label>
<label class="form-label" for="$ID">$Title</label>
</li>
<% end_loop %>
</ul>
4 changes: 2 additions & 2 deletions templates/SilverStripe/Forms/OptionsetField_holder.ss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<div id="$HolderID" class="field<% if $extraClass %> $extraClass<% end_if %>">
<% if $Title %><label class="left">$Title</label><% end_if %>
<% if $Title %><label class="form-label left">$Title</label><% end_if %>
<div class="middleColumn">
$Field
</div>
<% if $RightTitle %><label class="right">$RightTitle</label><% end_if %>
<% if $RightTitle %><label class="form-label right">$RightTitle</label><% end_if %>
<% if $Message %><span class="message $MessageType">$Message</span><% end_if %>
<% if $Description %><span class="description">$Description</span><% end_if %>
</div>
2 changes: 1 addition & 1 deletion templates/SilverStripe/Forms/SelectionGroup.ss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<ul class="SelectionGroup<% if extraClass %> $extraClass<% end_if %>">
<% loop $FieldSet %>
<li <% if Selected %>class="selected"<% end_if %>>
<label>{$RadioButton} {$RadioLabel}</label>
<label class="form-label">{$RadioButton} {$RadioLabel}</label>
<% if $FieldList %>
$FieldHolder
<% end_if %>
Expand Down
4 changes: 2 additions & 2 deletions templates/forms/HtmlEditorField_holder_small.ss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="fieldholder-small field htmleditor">
<% if $Title %><label class="fieldholder-small-label" <% if $ID %>for="$ID"<% end_if %>>$Title</label><% end_if %>
<% if $Title %><label class="form-label fieldholder-small-label" <% if $ID %>for="$ID"<% end_if %>>$Title</label><% end_if %>
$Field
<% if $RightTitle %><label class="right fieldholder-small-label" <% if $ID %>for="$ID"<% end_if %>>$RightTitle</label><% end_if %>
<% if $RightTitle %><label class="form-label right fieldholder-small-label" <% if $ID %>for="$ID"<% end_if %>>$RightTitle</label><% end_if %>
</div>
2 changes: 1 addition & 1 deletion tests/php/ORM/LabelFieldTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ class LabelFieldTest extends SapphireTest
public function testFieldHasNoNameAttribute()
{
$field = new LabelField('MyName', 'MyTitle');
$this->assertEquals('<label id="MyName" class="readonly">MyTitle</label>', trim($field->Field()));
$this->assertEquals('<label id="MyName" class="form-label readonly">MyTitle</label>', trim($field->Field()));
}
}

0 comments on commit 8689f17

Please sign in to comment.