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_content\Form; use Drupal\Core\Entity\EntityDeleteForm; use ..
Decoded Output download
<?php
namespace Drupallock_content\Form;
use Drupal\Core\Entity\EntityDeleteForm;
use Drupal\Core\Form\FormStateInterface;
/**
* Provides a confirmation form for deleting a custom block type entity.
*/
class BlockContentTypeDeleteForm extends EntityDeleteForm {
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$blocks = $this->entityTypeManager->getStorage('block_content')->getQuery()
->condition('type', $this->entity->id())
->execute();
if (!empty($blocks)) {
$caption = '<p>' . $this->formatPlural(count($blocks), '%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', '%label is used by @count custom blocks on your site. You may not remove %label until you have removed all of the %label custom blocks.', ['%label' => $this->entity->label()]) . '</p>';
$form['description'] = ['#markup' => $caption];
return $form;
}
else {
return parent::buildForm($form, $form_state);
}
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Drupal\block_content\Form;
use Drupal\Core\Entity\EntityDeleteForm;
use Drupal\Core\Form\FormStateInterface;
/**
* Provides a confirmation form for deleting a custom block type entity.
*/
class BlockContentTypeDeleteForm extends EntityDeleteForm {
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
$blocks = $this->entityTypeManager->getStorage('block_content')->getQuery()
->condition('type', $this->entity->id())
->execute();
if (!empty($blocks)) {
$caption = '<p>' . $this->formatPlural(count($blocks), '%label is used by 1 custom block on your site. You can not remove this block type until you have removed all of the %label blocks.', '%label is used by @count custom blocks on your site. You may not remove %label until you have removed all of the %label custom blocks.', ['%label' => $this->entity->label()]) . '</p>';
$form['description'] = ['#markup' => $caption];
return $form;
}
else {
return parent::buildForm($form, $form_state);
}
}
}
Function Calls
None |
Stats
MD5 | 078b933a258a1c587aad5e1d077ad830 |
Eval Count | 0 |
Decode Time | 67 ms |