class AvailableTestDumper

Same name in other branches
  1. 4.x tests/modules/devel_dumper_test/src/Plugin/Devel/Dumper/AvailableTestDumper.php \Drupal\devel_dumper_test\Plugin\Devel\Dumper\AvailableTestDumper

Provides a AvailableTestDumper plugin.

Plugin annotation


@DevelDumper(
  id = "available_test_dumper",
  label = @Translation("Available test dumper."),
  description = @Translation("Drupal dumper for testing purposes (available).")
)

Hierarchy

Expanded class hierarchy of AvailableTestDumper

File

tests/modules/devel_dumper_test/src/Plugin/Devel/Dumper/AvailableTestDumper.php, line 17

Namespace

Drupal\devel_dumper_test\Plugin\Devel\Dumper
View source
class AvailableTestDumper extends DevelDumperBase {
    
    /**
     * {@inheritdoc}
     */
    public function dump($input, $name = NULL) : void {
        // Add a predetermined string to $input to check if this dumper has been
        // selected successfully.
        $input = '<pre>AvailableTestDumper::dump() ' . $input . '</pre>';
        echo $input;
    }
    
    /**
     * {@inheritdoc}
     */
    public function export(mixed $input, ?string $name = NULL) : MarkupInterface|string {
        // Add a predetermined string to $input to check if this dumper has been
        // selected successfully.
        $input = '<pre>AvailableTestDumper::export() ' . $input . '</pre>';
        return $this->setSafeMarkup($input);
    }
    
    /**
     * {@inheritdoc}
     */
    public function exportAsRenderable($input, $name = NULL) : array {
        // Add a predetermined string to $input to check if this dumper has been
        // selected successfully.
        $input = '<pre>AvailableTestDumper::exportAsRenderable() ' . $input . '</pre>';
        return [
            '#attached' => [
                'library' => [
                    'devel_dumper_test/devel_dumper_test',
                ],
            ],
            '#markup' => $this->setSafeMarkup($input),
        ];
    }
    
    /**
     * {@inheritdoc}
     */
    public static function checkRequirements() : bool {
        return TRUE;
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
AvailableTestDumper::checkRequirements public static function Checks if requirements for this plugin are satisfied. Overrides DevelDumperInterface::checkRequirements
AvailableTestDumper::dump public function Dumps information about a variable. Overrides DevelDumperBase::dump
AvailableTestDumper::export public function Returns a string representation of a variable. Overrides DevelDumperInterface::export
AvailableTestDumper::exportAsRenderable public function Returns a string representation of a variable wrapped in a render array. Overrides DevelDumperBase::exportAsRenderable
DevelDumperBase::getInternalFunctions protected function Returns a list of internal functions. 1
DevelDumperBase::setSafeMarkup protected function Wrapper for \Drupal\Core\Render\Markup::create().