Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace Drupal\Core\Field\Plugin\Field\FieldFormatter; use Drupal\Core\Field\Att..

Decoded Output download

<?php

namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;

use Drupal\Core\Field\Attribute\FieldFormatter;
use Drupal\Core\Field\FormatterBase;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;

/**
 * Plugin implementation of the 'number_unformatted' formatter.
 */
#[FieldFormatter(
  id: 'number_unformatted',
  label: new TranslatableMarkup('Unformatted'),
  field_types: [
    'integer',
    'decimal',
    'float',
  ],
)]
class NumericUnformattedFormatter extends FormatterBase {

  /**
   * {@inheritdoc}
   */
  public function viewElements(FieldItemListInterface $items, $langcode) {
    $elements = [];

    foreach ($items as $delta => $item) {
      $elements[$delta] = ['#markup' => $item->value];
    }

    return $elements;
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Drupal\Core\Field\Plugin\Field\FieldFormatter;

use Drupal\Core\Field\Attribute\FieldFormatter;
use Drupal\Core\Field\FormatterBase;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;

/**
 * Plugin implementation of the 'number_unformatted' formatter.
 */
#[FieldFormatter(
  id: 'number_unformatted',
  label: new TranslatableMarkup('Unformatted'),
  field_types: [
    'integer',
    'decimal',
    'float',
  ],
)]
class NumericUnformattedFormatter extends FormatterBase {

  /**
   * {@inheritdoc}
   */
  public function viewElements(FieldItemListInterface $items, $langcode) {
    $elements = [];

    foreach ($items as $delta => $item) {
      $elements[$delta] = ['#markup' => $item->value];
    }

    return $elements;
  }

}

Function Calls

None

Variables

None

Stats

MD5 48ebe76d142af38c812686a14fae53fd
Eval Count 0
Decode Time 93 ms