Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
304
Merge Requests
304
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
d1c7fa1b
Unverified
Commit
d1c7fa1b
authored
Nov 19, 2018
by
larowlan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#3013187
by tim.plunkett: Rename PlaceholderInterface to PreviewFallbackInterface
parent
9e18995a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
10 deletions
+31
-10
core/lib/Drupal/Core/Block/BlockBase.php
core/lib/Drupal/Core/Block/BlockBase.php
+3
-3
core/lib/Drupal/Core/Render/PreviewFallbackInterface.php
core/lib/Drupal/Core/Render/PreviewFallbackInterface.php
+21
-0
core/modules/layout_builder/src/EventSubscriber/BlockComponentRenderArray.php
...builder/src/EventSubscriber/BlockComponentRenderArray.php
+3
-3
core/modules/layout_builder/src/Plugin/Block/ExtraFieldBlock.php
...dules/layout_builder/src/Plugin/Block/ExtraFieldBlock.php
+2
-2
core/modules/layout_builder/src/Plugin/Block/FieldBlock.php
core/modules/layout_builder/src/Plugin/Block/FieldBlock.php
+1
-1
core/modules/views/src/Plugin/Block/ViewsBlockBase.php
core/modules/views/src/Plugin/Block/ViewsBlockBase.php
+1
-1
No files found.
core/lib/Drupal/Core/Block/BlockBase.php
View file @
d1c7fa1b
...
...
@@ -11,7 +11,7 @@
use
Drupal\Core\Language\LanguageInterface
;
use
Drupal\Core\Plugin\PluginWithFormsInterface
;
use
Drupal\Core\Plugin\PluginWithFormsTrait
;
use
Drupal\Core\Render\P
laceholder
Interface
;
use
Drupal\Core\Render\P
reviewFallback
Interface
;
use
Drupal\Core\Session\AccountInterface
;
use
Drupal\Component\Transliteration\TransliterationInterface
;
...
...
@@ -24,7 +24,7 @@
*
* @ingroup block_api
*/
abstract
class
BlockBase
extends
ContextAwarePluginBase
implements
BlockPluginInterface
,
PluginWithFormsInterface
,
P
laceholder
Interface
{
abstract
class
BlockBase
extends
ContextAwarePluginBase
implements
BlockPluginInterface
,
PluginWithFormsInterface
,
P
reviewFallback
Interface
{
use
ContextAwarePluginAssignmentTrait
;
use
MessengerTrait
;
...
...
@@ -256,7 +256,7 @@ public function getMachineNameSuggestion() {
/**
* {@inheritdoc}
*/
public
function
getP
laceholder
String
()
{
public
function
getP
reviewFallback
String
()
{
return
$this
->
t
(
'Placeholder for the "@block" block'
,
[
'@block'
=>
$this
->
label
()]);
}
...
...
core/lib/Drupal/Core/Render/P
laceholder
Interface.php
→
core/lib/Drupal/Core/Render/P
reviewFallback
Interface.php
View file @
d1c7fa1b
...
...
@@ -3,19 +3,19 @@
namespace
Drupal\Core\Render
;
/**
* Allows an element to provide a
placeholder representation of itself
.
* Allows an element to provide a
fallback representation of itself for preview
.
*/
interface
P
laceholder
Interface
{
interface
P
reviewFallback
Interface
{
/**
* Returns a string to be used as a
placeholder
.
* Returns a string to be used as a
fallback during preview
.
*
* This is typically used when an element has no output and must be displayed,
* for example during configuration.
*
* @return string|\Drupal\Core\StringTranslation\TranslatableMarkup
* A
placeholder string for this element
.
* A
string representing for this
.
*/
public
function
getP
laceholder
String
();
public
function
getP
reviewFallback
String
();
}
core/modules/layout_builder/src/EventSubscriber/BlockComponentRenderArray.php
View file @
d1c7fa1b
...
...
@@ -6,7 +6,7 @@
use
Drupal\Core\Access\AccessResult
;
use
Drupal\Core\Block\BlockPluginInterface
;
use
Drupal\Core\Render\Element
;
use
Drupal\Core\Render\P
laceholder
Interface
;
use
Drupal\Core\Render\P
reviewFallback
Interface
;
use
Drupal\Core\Session\AccountInterface
;
use
Drupal\layout_builder
\
Access\LayoutPreviewAccessAllowed
;
use
Drupal\layout_builder
\
Event\SectionComponentBuildRenderArrayEvent
;
...
...
@@ -100,8 +100,8 @@ public function onBuildRender(SectionComponentBuildRenderArrayEvent $event) {
'#weight'
=>
$event
->
getComponent
()
->
getWeight
(),
'content'
=>
$block
->
build
(),
];
if
(
$event
->
inPreview
()
&&
Element
::
isEmpty
(
$build
[
'content'
])
&&
$block
instanceof
P
laceholder
Interface
)
{
$build
[
'content'
][
'#markup'
]
=
$block
->
getP
laceholder
String
();
if
(
$event
->
inPreview
()
&&
Element
::
isEmpty
(
$build
[
'content'
])
&&
$block
instanceof
P
reviewFallback
Interface
)
{
$build
[
'content'
][
'#markup'
]
=
$block
->
getP
reviewFallback
String
();
}
$event
->
setBuild
(
$build
);
}
...
...
core/modules/layout_builder/src/Plugin/Block/ExtraFieldBlock.php
View file @
d1c7fa1b
...
...
@@ -130,7 +130,7 @@ public function build() {
// render array. If the hook is invoked the placeholder will be
// replaced.
// @see ::replaceFieldPlaceholder()
'#markup'
=>
$this
->
getP
laceholder
String
(),
'#markup'
=>
$this
->
getP
reviewFallback
String
(),
];
}
CacheableMetadata
::
createFromObject
(
$this
)
->
applyTo
(
$build
);
...
...
@@ -140,7 +140,7 @@ public function build() {
/**
* {@inheritdoc}
*/
public
function
getP
laceholder
String
()
{
public
function
getP
reviewFallback
String
()
{
$entity
=
$this
->
getEntity
();
$extra_fields
=
$this
->
entityFieldManager
->
getExtraFields
(
$entity
->
getEntityTypeId
(),
$entity
->
bundle
());
return
new
TranslatableMarkup
(
'Placeholder for the "@field" field'
,
[
'@field'
=>
$extra_fields
[
'display'
][
$this
->
fieldName
][
'label'
]]);
...
...
core/modules/layout_builder/src/Plugin/Block/FieldBlock.php
View file @
d1c7fa1b
...
...
@@ -166,7 +166,7 @@ public function build() {
/**
* {@inheritdoc}
*/
public
function
getP
laceholder
String
()
{
public
function
getP
reviewFallback
String
()
{
return
new
TranslatableMarkup
(
'Placeholder for the "@field" field'
,
[
'@field'
=>
$this
->
getFieldDefinition
()
->
getLabel
()]);
}
...
...
core/modules/views/src/Plugin/Block/ViewsBlockBase.php
View file @
d1c7fa1b
...
...
@@ -108,7 +108,7 @@ public function defaultConfiguration() {
/**
* {@inheritdoc}
*/
public
function
getP
laceholder
String
()
{
public
function
getP
reviewFallback
String
()
{
return
$this
->
t
(
'Placeholder for the "@view" views block'
,
[
'@view'
=>
$this
->
view
->
storage
->
label
()]);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment