Skip to content

Commit f593ab7

Browse files
authored
Introduce a document aware interface (#40662)
* Introduce a document aware interface * cs ---------
1 parent 2d9fb98 commit f593ab7

File tree

51 files changed

+361
-149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+361
-149
lines changed

administrator/components/com_associations/src/View/Association/HtmlView.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ public function display($tpl = null): void
318318
* Let's put the target src into a variable to use in the javascript code
319319
* to avoid race conditions when the reference iframe loads.
320320
*/
321-
$this->document->addScriptOptions('targetSrc', Route::_($this->editUri . '&task=' . $task . '&id=' . (int) $this->targetId));
321+
$this->getDocument()->addScriptOptions('targetSrc', Route::_($this->editUri . '&task=' . $task . '&id=' . (int) $this->targetId));
322322
$this->form->setValue('itemlanguage', '', $this->targetLanguage . ':' . $this->targetId . ':' . $this->targetAction);
323323
}
324324

administrator/components/com_banners/src/View/Tracks/RawView.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function display($tpl = null): void
5353
throw new GenericDataException(implode("\n", $errors), 500);
5454
}
5555

56-
$this->document->setMimeEncoding($mimeType);
56+
$this->getDocument()->setMimeEncoding($mimeType);
5757

5858
/** @var CMSApplication $app */
5959
$app = Factory::getApplication();

administrator/components/com_categories/src/View/Categories/HtmlView.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ protected function addToolbar()
188188

189189
// Load specific css component
190190
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
191-
$wa = $this->document->getWebAssetManager();
191+
$wa = $this->getDocument()->getWebAssetManager();
192192
$wa->getRegistry()->addExtensionRegistryFile($component);
193193

194194
if ($wa->assetExists('style', $component . '.admin-categories')) {

administrator/components/com_categories/src/View/Category/HtmlView.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ protected function addToolbar()
173173

174174
// Load specific css component
175175
/** @var \Joomla\CMS\WebAsset\WebAssetManager $wa */
176-
$wa = $this->document->getWebAssetManager();
176+
$wa = $this->getDocument()->getWebAssetManager();
177177
$wa->getRegistry()->addExtensionRegistryFile($component);
178178

179179
if ($wa->assetExists('style', $component . '.admin-categories')) {

administrator/components/com_privacy/src/View/Export/XmlView.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ public function display($tpl = null)
5353
$requestId = $model->getState($model->getName() . '.request_id');
5454

5555
// This document should always be downloaded
56-
$this->document->setDownload(true);
57-
$this->document->setName('export-request-' . $requestId);
56+
$this->getDocument()->setDownload(true);
57+
$this->getDocument()->setName('export-request-' . $requestId);
5858

5959
echo PrivacyHelper::renderDataAsXml($exportData);
6060
}

api/components/com_config/src/View/Application/JsonapiView.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function displayList(array $items = null)
6060

6161
$items = array_splice($items, $offset, $limit);
6262

63-
$this->document->addMeta('total-pages', $totalPagesAvailable)
63+
$this->getDocument()->addMeta('total-pages', $totalPagesAvailable)
6464
->addLink('self', (string) $currentUrl);
6565

6666
// Check for first and previous pages
@@ -76,7 +76,7 @@ public function displayList(array $items = null)
7676
$previousPageQuery['offset'] = $previousOffset >= 0 ? $previousOffset : 0;
7777
$previousPage->setVar('page', $previousPageQuery);
7878

79-
$this->document->addLink('first', $this->queryEncode((string) $firstPage))
79+
$this->getDocument()->addLink('first', $this->queryEncode((string) $firstPage))
8080
->addLink('previous', $this->queryEncode((string) $previousPage));
8181
}
8282

@@ -93,16 +93,16 @@ public function displayList(array $items = null)
9393
$lastPageQuery['offset'] = ($totalPagesAvailable - 1) * $limit;
9494
$lastPage->setVar('page', $lastPageQuery);
9595

96-
$this->document->addLink('next', $this->queryEncode((string) $nextPage))
96+
$this->getDocument()->addLink('next', $this->queryEncode((string) $nextPage))
9797
->addLink('last', $this->queryEncode((string) $lastPage));
9898
}
9999

100100
$collection = (new Collection($items, new JoomlaSerializer($this->type)));
101101

102102
// Set the data into the document and render it
103-
$this->document->setData($collection);
103+
$this->getDocument()->setData($collection);
104104

105-
return $this->document->render();
105+
return $this->getDocument()->render();
106106
}
107107

108108
/**

api/components/com_config/src/View/Component/JsonapiView.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public function displayList(array $items = null)
7272

7373
$items = array_splice($items, $offset, $limit);
7474

75-
$this->document->addMeta('total-pages', $totalPagesAvailable)
75+
$this->getDocument()->addMeta('total-pages', $totalPagesAvailable)
7676
->addLink('self', (string) $currentUrl);
7777

7878
// Check for first and previous pages
@@ -88,7 +88,7 @@ public function displayList(array $items = null)
8888
$previousPageQuery['offset'] = $previousOffset >= 0 ? $previousOffset : 0;
8989
$previousPage->setVar('page', $previousPageQuery);
9090

91-
$this->document->addLink('first', $this->queryEncode((string) $firstPage))
91+
$this->getDocument()->addLink('first', $this->queryEncode((string) $firstPage))
9292
->addLink('previous', $this->queryEncode((string) $previousPage));
9393
}
9494

@@ -105,16 +105,16 @@ public function displayList(array $items = null)
105105
$lastPageQuery['offset'] = ($totalPagesAvailable - 1) * $limit;
106106
$lastPage->setVar('page', $lastPageQuery);
107107

108-
$this->document->addLink('next', $this->queryEncode((string) $nextPage))
108+
$this->getDocument()->addLink('next', $this->queryEncode((string) $nextPage))
109109
->addLink('last', $this->queryEncode((string) $lastPage));
110110
}
111111

112112
$collection = (new Collection($items, new JoomlaSerializer($this->type)));
113113

114114
// Set the data into the document and render it
115-
$this->document->setData($collection);
115+
$this->getDocument()->setData($collection);
116116

117-
return $this->document->render();
117+
return $this->getDocument()->render();
118118
}
119119

120120
/**

api/components/com_languages/src/View/Strings/JsonapiView.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ public function displayList(array $items = null)
7777
->fields([$this->type => $this->fieldsToRenderList]);
7878

7979
// Set the data into the document and render it
80-
$this->document->setData($collection);
80+
$this->getDocument()->setData($collection);
8181

82-
return $this->document->render();
82+
return $this->getDocument()->render();
8383
}
8484

8585
/**

api/components/com_menus/src/View/Items/JsonapiView.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,15 @@ public function displayListTypes()
178178
$collection = (new Collection($items, new JoomlaSerializer('menutypes')));
179179

180180
// Set the data into the document and render it
181-
$this->document->addMeta('total-pages', $totalPagesAvailable)
181+
$this->getDocument()->addMeta('total-pages', $totalPagesAvailable)
182182
->setData($collection)
183183
->addLink('self', (string) $currentUrl)
184184
->addLink('first', (string) $firstPage)
185185
->addLink('next', (string) $nextPage)
186186
->addLink('previous', (string) $previousPage)
187187
->addLink('last', (string) $lastPage);
188188

189-
return $this->document->render();
189+
return $this->getDocument()->render();
190190
}
191191

192192
/**

api/components/com_privacy/src/View/Consents/JsonapiView.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,9 @@ public function displayItem($item = null)
112112
$element = (new Resource($displayItem, $serializer))
113113
->fields([$this->type => $this->fieldsToRenderItem]);
114114

115-
$this->document->setData($element);
116-
$this->document->addLink('self', Uri::current());
115+
$this->getDocument()->setData($element);
116+
$this->getDocument()->addLink('self', Uri::current());
117117

118-
return $this->document->render();
118+
return $this->getDocument()->render();
119119
}
120120
}

0 commit comments

Comments
 (0)