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\block\Plugin\migrate\destination; use Drupal\Core\Config\Schema\S..

Decoded Output download

<?php

namespace Drupallock\Plugin\migrate\destination;

use Drupal\Core\Config\Schema\SchemaIncompleteException;
use Drupal\migrate\Attribute\MigrateDestination;
use Drupal\migrate\MigrateException;
use Drupal\migrate\Plugin\migrate\destination\EntityConfigBase;
use Drupal\migrate\Row;

/**
 * Migrate destination for block entity.
 */
#[MigrateDestination('entity:block')]
class EntityBlock extends EntityConfigBase {

  /**
   * {@inheritdoc}
   */
  protected function getEntityId(Row $row) {
    // Try to find the block by its plugin ID and theme.
    $properties = [
      'plugin' => $row->getDestinationProperty('plugin'),
      'theme' => $row->getDestinationProperty('theme'),
    ];
    $blocks = array_keys($this->storage->loadByProperties($properties));
    return reset($blocks);
  }

  /**
   * {@inheritdoc}
   */
  public function import(Row $row, array $old_destination_id_values = []) {
    try {
      $entity_ids = parent::import($row, $old_destination_id_values);
    }
    catch (SchemaIncompleteException $e) {
      throw new MigrateException($e->getMessage());
    }
    return $entity_ids;
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Drupal\block\Plugin\migrate\destination;

use Drupal\Core\Config\Schema\SchemaIncompleteException;
use Drupal\migrate\Attribute\MigrateDestination;
use Drupal\migrate\MigrateException;
use Drupal\migrate\Plugin\migrate\destination\EntityConfigBase;
use Drupal\migrate\Row;

/**
 * Migrate destination for block entity.
 */
#[MigrateDestination('entity:block')]
class EntityBlock extends EntityConfigBase {

  /**
   * {@inheritdoc}
   */
  protected function getEntityId(Row $row) {
    // Try to find the block by its plugin ID and theme.
    $properties = [
      'plugin' => $row->getDestinationProperty('plugin'),
      'theme' => $row->getDestinationProperty('theme'),
    ];
    $blocks = array_keys($this->storage->loadByProperties($properties));
    return reset($blocks);
  }

  /**
   * {@inheritdoc}
   */
  public function import(Row $row, array $old_destination_id_values = []) {
    try {
      $entity_ids = parent::import($row, $old_destination_id_values);
    }
    catch (SchemaIncompleteException $e) {
      throw new MigrateException($e->getMessage());
    }
    return $entity_ids;
  }

}

Function Calls

None

Variables

None

Stats

MD5 150407e22e1029ce68a473a2805787ca
Eval Count 0
Decode Time 84 ms