mirror of
https://github.com/silverstripe/silverstripe-iframe
synced 2024-10-22 11:05:51 +02:00
FIX Add CMS configurable title for iframe to tell screenreaders it contains frame content
This commit is contained in:
parent
58113b4d77
commit
9082db159c
@ -8,6 +8,8 @@ use SilverStripe\Forms\CheckboxField;
|
|||||||
use SilverStripe\Forms\NumericField;
|
use SilverStripe\Forms\NumericField;
|
||||||
use SilverStripe\Forms\HTMLEditor\HtmlEditorField;
|
use SilverStripe\Forms\HTMLEditor\HtmlEditorField;
|
||||||
use SilverStripe\ORM\FieldType\DBField;
|
use SilverStripe\ORM\FieldType\DBField;
|
||||||
|
use SilverStripe\ORM\ValidationException;
|
||||||
|
use SilverStripe\ORM\ValidationResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iframe page type embeds an iframe of URL of choice into the page.
|
* Iframe page type embeds an iframe of URL of choice into the page.
|
||||||
@ -18,6 +20,7 @@ class IFramePage extends Page
|
|||||||
{
|
{
|
||||||
private static $db = array(
|
private static $db = array(
|
||||||
'IFrameURL' => 'Text',
|
'IFrameURL' => 'Text',
|
||||||
|
'IFrameTitle' => 'Varchar',
|
||||||
'AutoHeight' => 'Boolean(1)',
|
'AutoHeight' => 'Boolean(1)',
|
||||||
'AutoWidth' => 'Boolean(1)',
|
'AutoWidth' => 'Boolean(1)',
|
||||||
'FixedHeight' => 'Int(500)',
|
'FixedHeight' => 'Int(500)',
|
||||||
@ -45,7 +48,11 @@ class IFramePage extends Page
|
|||||||
$fields = parent::getCMSFields();
|
$fields = parent::getCMSFields();
|
||||||
|
|
||||||
$fields->removeFieldFromTab('Root.Main', 'Content');
|
$fields->removeFieldFromTab('Root.Main', 'Content');
|
||||||
$fields->addFieldToTab('Root.Main', $url = new TextField('IFrameURL', 'Iframe URL'));
|
$fields->addFieldsToTab('Root.Main', [
|
||||||
|
$url = TextField::create('IFrameURL', 'Iframe URL'),
|
||||||
|
TextField::create('IFrameTitle', 'Iframe Title')
|
||||||
|
->setDescription(_t(__CLASS__ . '.TITLE_DESCRIPTION', 'Used to identify the contents of the Iframe')),
|
||||||
|
]);
|
||||||
$url->setRightTitle(
|
$url->setRightTitle(
|
||||||
DBField::create_field(
|
DBField::create_field(
|
||||||
'HTMLText',
|
'HTMLText',
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<div class="nonvisual-indicator" style="position: absolute; overflow: hidden; clip: rect(0 0 0 0); height: 1px; width: 1px; margin: -1px; padding: 0; border: 0;">
|
<div class="nonvisual-indicator" style="position: absolute; overflow: hidden; clip: rect(0 0 0 0); height: 1px; width: 1px; margin: -1px; padding: 0; border: 0;">
|
||||||
<%t SilverStripe\\IFrame\\IFramePage.ExternalNote "Please note the following section of content is possibly being delivered from an external source (IFRAME in HTML terms), and may present unusual experiences for screen readers." %>
|
<%t SilverStripe\\IFrame\\IFramePage.ExternalNote "Please note the following section of content is possibly being delivered from an external source (IFRAME in HTML terms), and may present unusual experiences for screen readers." %>
|
||||||
</div>
|
</div>
|
||||||
<iframe id="Iframepage-iframe" style="$Style" src="$IFrameURL" class="$Class">$AlternateContent</iframe>
|
<iframe id="Iframepage-iframe" style="$Style" src="$IFrameURL" class="$Class" title="$IFrameTitle">$AlternateContent</iframe>
|
||||||
<% end_if %>
|
<% end_if %>
|
||||||
$BottomContent
|
$BottomContent
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user