class Markup
Same name in this branch
- 9 core/lib/Drupal/Core/Render/Markup.php \Drupal\Core\Render\Markup
Same name and namespace in other branches
- 11.x core/modules/views/src/Plugin/views/field/Markup.php \Drupal\views\Plugin\views\field\Markup
- 11.x core/lib/Drupal/Core/Render/Markup.php \Drupal\Core\Render\Markup
- 10 core/modules/views/src/Plugin/views/field/Markup.php \Drupal\views\Plugin\views\field\Markup
- 10 core/lib/Drupal/Core/Render/Markup.php \Drupal\Core\Render\Markup
- 8.9.x core/modules/views/src/Plugin/views/field/Markup.php \Drupal\views\Plugin\views\field\Markup
- 8.9.x core/lib/Drupal/Core/Render/Markup.php \Drupal\Core\Render\Markup
Handler to run a field through check_markup, using a companion format field.
- format: (REQUIRED) Either a string format id to use for this field or an array('field' => {$field}) where $field is the field in this table used to control the format such as the 'format' field in the node, which goes with the 'body' field.
Plugin annotation
@ViewsField("markup");
Hierarchy
- class \Drupal\Component\Plugin\PluginBase extends \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
- class \Drupal\views\Plugin\views\PluginBase extends \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\views\Plugin\views\HandlerBase extends \Drupal\views\Plugin\views\ViewsHandlerInterface implements \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\field\FieldPluginBase extends \Drupal\views\Plugin\views\field\FieldHandlerInterface implements \Drupal\views\Plugin\views\HandlerBase
- class \Drupal\views\Plugin\views\field\Markup implements \Drupal\views\Plugin\views\field\FieldPluginBase
- class \Drupal\views\Plugin\views\field\FieldPluginBase extends \Drupal\views\Plugin\views\field\FieldHandlerInterface implements \Drupal\views\Plugin\views\HandlerBase
- class \Drupal\views\Plugin\views\HandlerBase extends \Drupal\views\Plugin\views\ViewsHandlerInterface implements \Drupal\views\Plugin\views\PluginBase
- class \Drupal\views\Plugin\views\PluginBase extends \Drupal\Core\Plugin\ContainerFactoryPluginInterface, \Drupal\views\Plugin\views\ViewsPluginInterface, \Drupal\Component\Plugin\DependentPluginInterface, \Drupal\Core\Security\TrustedCallbackInterface implements \Drupal\Core\Plugin\PluginBase
- class \Drupal\Core\Plugin\PluginBase uses \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Messenger\MessengerTrait implements \Drupal\Component\Plugin\PluginBase
Expanded class hierarchy of Markup
Related topics
3 string references to 'Markup'
- AjaxRendererTest::setUp in core/
tests/ Drupal/ Tests/ Core/ Controller/ AjaxRendererTest.php - DrupalMessengerServiceTest::testStatusMessageAssertions in core/
modules/ system/ tests/ src/ Functional/ Bootstrap/ DrupalMessengerServiceTest.php - Tests assertion methods in WebAssert related to status messages.
- views.field.schema.yml in core/
modules/ views/ config/ schema/ views.field.schema.yml - core/modules/views/config/schema/views.field.schema.yml
File
-
core/
modules/ views/ src/ Plugin/ views/ field/ Markup.php, line 21
Namespace
Drupal\views\Plugin\views\fieldView source
class Markup extends FieldPluginBase {
/**
* {@inheritdoc}
*/
public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
parent::init($view, $display, $options);
$this->format = $this->definition['format'];
$this->additional_fields = [];
if (is_array($this->format)) {
$this->additional_fields['format'] = $this->format;
}
}
/**
* {@inheritdoc}
*/
public function render(ResultRow $values) {
$value = $this->getValue($values);
if (is_array($this->format)) {
$format = $this->getValue($values, 'format');
}
else {
$format = $this->format;
}
if ($value) {
$value = str_replace('<!--break-->', '', $value);
return check_markup($value, $format);
}
}
/**
* {@inheritdoc}
*/
public function elementType($none_supported = FALSE, $default_empty = FALSE, $inline = FALSE) {
if ($inline) {
return 'span';
}
if (isset($this->definition['element type'])) {
return $this->definition['element type'];
}
return 'div';
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.