Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate obsolete helpers #102

Merged
merged 3 commits into from
Jan 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions docs/book/helpers/html-object.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,31 @@
# HtmlObject

The HTML `<object>` element is used for embedding media like Flash or QuickTime
in web pages. The object view helpers take care of embedding media with minimum
effort.
The [HTML `<object>` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/object) is used for embedding external media in web pages. The object view helpers take care of embedding media with minimum effort.

There are four initial Object helpers:

- `htmlFlash()` Generates markup for embedding Flash files.
- `htmlObject()` Generates markup for embedding a custom Object.
- `htmlPage()` Generates markup for embedding other (X)HTML pages.
- `htmlQuicktime()` Generates markup for embedding QuickTime files.
- `htmlFlash()` Generates markup for embedding Flash files. _**Deprecated**_
- `htmlQuicktime()` Generates markup for embedding QuickTime files. _**Deprecated**_

All of these helpers share a similar interface. For this reason, this
documentation will only contain examples of two of these helpers.

## Flash helper
## HtmlPage helper

Embedding Flash in your page using the helper only requires the resource URI.
Embedding an external HTML page in your page using the helper only requires the resource URI.

```php
<?= $this->htmlFlash('/path/to/flash.swf'); ?>
<?= $this->htmlPage('https://www.example.com/some-page.html'); ?>
```

This outputs the following HTML:

```html
<object data="/path/to/flash.swf"
type="application/x-shockwave-flash"
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">
<object data="https://www.example.com/some-page.html"
type="text/html"
classid="clsid:25336920-03F9-11CF-8FD0-00AA00686F13">
</object>
```

Expand Down
1 change: 1 addition & 0 deletions src/Helper/HtmlFlash.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use function array_merge;

/** @deprecated Adobe Flash is obsolete. This helper will be removed in 3.0 */
class HtmlFlash extends AbstractHtmlElement
{
/**
Expand Down
1 change: 1 addition & 0 deletions src/Helper/HtmlQuicktime.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use function array_merge;

/** @deprecated */
class HtmlQuicktime extends AbstractHtmlElement
{
/**
Expand Down
10 changes: 8 additions & 2 deletions src/HelperPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class HelperPluginManager extends AbstractPluginManager
* Most of these are present for legacy purposes, as v2 of the service
* manager normalized names when fetching services.
*
* @psalm-suppress DeprecatedClass
* @var array<string, string>
*/
protected $aliases = [
Expand Down Expand Up @@ -144,8 +145,12 @@ class HelperPluginManager extends AbstractPluginManager
'viewModel' => Helper\ViewModel::class,
'ViewModel' => Helper\ViewModel::class,

// Legacy Zend Framework aliases
// @codingStandardsIgnoreStart
/**
* Legacy Zend Framework aliases
*
* @psalm-suppress DeprecatedClass
* @codingStandardsIgnoreStart
**/
\Zend\View\Helper\Asset::class => Helper\Asset::class,
\Zend\View\Helper\FlashMessenger::class => Helper\FlashMessenger::class,
\Zend\View\Helper\Identity::class => Helper\Identity::class,
Expand Down Expand Up @@ -231,6 +236,7 @@ class HelperPluginManager extends AbstractPluginManager
* helper works fine as an invokable. The factory for doctype simply checks for the
* config value from the merged config.
*
* @psalm-suppress DeprecatedClass
* @var string[]|callable[]
*/
protected $factories = [
Expand Down
8 changes: 6 additions & 2 deletions test/Helper/HtmlFlashTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
*/
class HtmlFlashTest extends TestCase
{
/** @var HtmlFlash */
/**
* @psalm-suppress DeprecatedClass
* @var HtmlFlash
*/
public $helper;

/**
Expand All @@ -25,7 +28,8 @@ class HtmlFlashTest extends TestCase
*/
protected function setUp(): void
{
$this->view = new View();
$this->view = new View();
/** @psalm-suppress DeprecatedClass */
$this->helper = new HtmlFlash();
$this->helper->setView($this->view);
}
Expand Down
8 changes: 6 additions & 2 deletions test/Helper/HtmlQuicktimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
*/
class HtmlQuicktimeTest extends TestCase
{
/** @var HtmlQuicktime */
/**
* @psalm-suppress DeprecatedClass
* @var HtmlQuicktime
*/
public $helper;
/** @var View */
private $view;
Expand All @@ -27,7 +30,8 @@ class HtmlQuicktimeTest extends TestCase
*/
protected function setUp(): void
{
$this->view = new View();
$this->view = new View();
/** @psalm-suppress DeprecatedClass */
$this->helper = new HtmlQuicktime();
$this->helper->setView($this->view);
}
Expand Down