<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed><type>rich</type><version>1.0</version><provider_name>phorkie</provider_name><provider_url>https://p.cweiske.de/</provider_url><title>TYPO3 extbase: Page UID and content element UID</title><author_name>Christian Weiske</author_name><cache_age>86400</cache_age><width>900</width><height>900</height><html>&lt;!-- embedding all files of https://p.cweiske.de/761 --&gt;
&lt;link rel="stylesheet" href="https://p.cweiske.de/css/embed.css"/&gt;
&lt;div class="phork" id="761"&gt;
    &lt;div class="phork-file"&gt;
 &lt;div class="phork-content"&gt;
  
&lt;div class="document"&gt;


&lt;div class="section" id="extbase-controller-v12"&gt;
&lt;h1&gt;Extbase controller v12&lt;/h1&gt;
&lt;pre class="literal-block"&gt;
$this-&amp;gt;currentRequest-&amp;gt;getAttribute('routing')-&amp;gt;getPageId();
&lt;/pre&gt;
&lt;p&gt;or:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$uriBuilder-&amp;gt;getRequest()-&amp;gt;getAttribute('routing')-&amp;gt;getPageId();
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="extbase-controller-v10"&gt;
&lt;h1&gt;Extbase controller v10&lt;/h1&gt;
&lt;p&gt;Access the current page's ID and content element ID in an exbase controller action:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
$contentObj = $this-&amp;gt;configurationManager-&amp;gt;getContentObject();
$pageUid = $contentObj-&amp;gt;data['pid'];
$contentElementUid = $contentObj-&amp;gt;data['uid'];
&lt;/pre&gt;
&lt;/div&gt;
&lt;div class="section" id="fluid"&gt;
&lt;h1&gt;Fluid&lt;/h1&gt;
&lt;p&gt;With vhs:&lt;/p&gt;
&lt;pre class="literal-block"&gt;
{v:page.info(field: 'uid')}
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

 &lt;/div&gt;
 &lt;div class="phork-meta"&gt;
  &lt;a href="https://p.cweiske.de/761/rev-raw/6c136a085ad0cf746fe03aa8633172c8ee975577/README.rst" style="float: right"&gt;view raw source&lt;/a&gt;
  &lt;a href="https://p.cweiske.de/761#README.rst"&gt;README.rst&lt;/a&gt;
 &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</html></oembed>
