[TASK] Fix code examples in MetaTagManager docs 21/59021/3
authorGeorg Ringer <georg.ringer@gmail.com>
Tue, 4 Dec 2018 07:11:43 +0000 (08:11 +0100)
committerBenni Mack <benni@typo3.org>
Tue, 4 Dec 2018 10:28:23 +0000 (11:28 +0100)
The code of the MetaTagManager changed with #85197 and the docs need to be
adopted.

Resolves: #86924
Releases: master
Change-Id: If69a7e1d349845d9d0caa351ed67dab6e693c3ac
Reviewed-on: https://review.typo3.org/59021
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Josef Glatz <josef.glatz@typo3.org>
Tested-by: Josef Glatz <josef.glatz@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/core/Documentation/Changelog/9.3/Feature-81464-AddAPIForMetaTagManagement.rst

index 4e3f3bd..aed494c 100644 (file)
@@ -24,7 +24,7 @@ You can use that manager to add your meta tag; see the example below for the :ht
 
 .. code-block:: php
 
-    $metaTagManager = \TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry::getInstance()->getManagerForProperty('og:title');
+    $metaTagManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry::class)->getManagerForProperty('og:title');
     $metaTagManager->addProperty('og:title', 'This is the OG title from a controller');
 
 This code will result in a :html:`<meta property="og:title" content="This is the OG title from a controller" />` tag in frontend.
@@ -33,21 +33,21 @@ If you need to specify sub-properties, e.g. :html:`og:image:width`, you can use
 
 .. code-block:: php
 
-    $metaTagManager = \TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry::getInstance()->getManagerForProperty('og:image');
+    $metaTagManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry::class)->getManagerForProperty('og:image');
     $metaTagManager->addProperty('og:image', '/path/to/image.jpg', ['width' => 400, 'height' => 400]);
 
 You can also remove a specific property:
 
 .. code-block:: php
 
-    $metaTagManager = \TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry::getInstance()->getManagerForProperty('og:title');
+    $metaTagManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry::class)->getManagerForProperty('og:title');
     $metaTagManager->removeProperty('og:title');
 
 Or remove all previously set meta tags of a specific manager:
 
 .. code-block:: php
 
-    $metaTagManager = \TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry::getInstance()->getManagerForProperty('og:title');
+    $metaTagManager = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry::class)->getManagerForProperty('og:title');
     $metaTagManager->removeAllProperties();
 
 
@@ -62,7 +62,7 @@ To use the manager, you must register it in :php:`ext_localconf.php`:
 
 .. code-block:: php
 
-    $metaTagManagerRegistry = \TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry::getInstance();
+    $metaTagManagerRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry::class);
     $metaTagManagerRegistry->registerManager(
         'custom',
         \Some\CustomExtension\MetaTag\CustomMetaTagManager::class
@@ -74,7 +74,7 @@ want to implement your own :php:`OpenGraphMetaTagManager`, you can use the follo
 
 .. code-block:: php
 
-    $metaTagManagerRegistry = \TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry::getInstance();
+    $metaTagManagerRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry::class);
     $metaTagManagerRegistry->registerManager(
         'myOwnOpenGraphManager',
         \Some\CustomExtension\MetaTag\MyOpenGraphMetaTagManager::class,