Commit 443b5c2c authored by Daniel Speicher's avatar Daniel Speicher Committed by Jürgen Haas
Browse files

Issue #3268540 by danielspeicher, jurgenhaas, mxh: Cleanup code to pass PHPCS tests

parent a95bdf91
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ function eca_help($route_name): string {
      $output .= '<li>';
      $output .= '<strong>' . $definition['label'] . '</strong>';
      if ($tags_info) {
        $output .= ' <em>(' . t('Characteristics: ') . implode(', ', $tags_info) . ')</em>';
        $output .= ' <em>(' . t('Characteristics: @tags', ['@tags' => implode(', ', $tags_info)]) . ')</em>';
      }
      $output .= '</li>';
    }
+3 −0
Original line number Diff line number Diff line
@@ -18,7 +18,10 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\eca_content\HookHandler;

/**
 * Eca content hooh handler.
 *
 * @return \Drupal\eca_content\HookHandler
 *   The content hook handler.
 */
function _eca_content_hook_handler(): HookHandler {
  return \Drupal::service('eca_content.hook_handler');
+18 −1
Original line number Diff line number Diff line
@@ -8,11 +8,15 @@ namespace Drupal\eca_content\Event;
abstract class ContentEntityBaseBundle extends ContentEntityBase {

  /**
   * The entity type id.
   *
   * @var string
   */
  protected string $entityTypeId;

  /**
   * The bundle.
   *
   * @var string
   */
  protected string $bundle;
@@ -21,7 +25,9 @@ abstract class ContentEntityBaseBundle extends ContentEntityBase {
   * ContentEntityBaseBundle constructor.
   *
   * @param string $entity_type_id
   *   The entity type id.
   * @param string $bundle
   *   The bundle.
   */
  public function __construct(string $entity_type_id, string $bundle) {
    $this->entityTypeId = $entity_type_id;
@@ -29,14 +35,20 @@ abstract class ContentEntityBaseBundle extends ContentEntityBase {
  }

  /**
   * Gets the entity type id.
   *
   * @return string
   *   The entity type id.
   */
  public function getEntityTypeId(): string {
    return $this->entityTypeId;
  }

  /**
   * Gets the bundle.
   *
   * @return string
   *   The bundle.
   */
  public function getBundle(): string {
    return $this->bundle;
@@ -46,7 +58,12 @@ abstract class ContentEntityBaseBundle extends ContentEntityBase {
   * {@inheritdoc}
   */
  public function appliesForLazyLoadingWildcard(string $wildcard): bool {
    return in_array($wildcard, ['*', $this->entityTypeId, $this->entityTypeId . '::' . $this->bundle]);
    return in_array($wildcard, [
      '*',
      $this->entityTypeId,
      $this->entityTypeId . '::' . $this->bundle,
    ]
    );
  }

}
+12 −1
Original line number Diff line number Diff line
@@ -13,11 +13,15 @@ use Drupal\eca_content\Service\EntityTypes;
abstract class ContentEntityBaseEntity extends ContentEntityBase implements ContentEntityEventInterface {

  /**
   * The entity.
   *
   * @var \Drupal\Core\Entity\EntityInterface
   */
  protected EntityInterface $entity;

  /**
   * The entity type service.
   *
   * @var \Drupal\eca_content\Service\EntityTypes
   */
  protected EntityTypes $entityTypes;
@@ -26,7 +30,9 @@ abstract class ContentEntityBaseEntity extends ContentEntityBase implements Cont
   * ContentEntityBaseEntity constructor.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface $entity
   *   The entity.
   * @param \Drupal\eca_content\Service\EntityTypes $entity_types
   *   The entity type service.
   */
  public function __construct(ContentEntityInterface $entity, EntityTypes $entity_types) {
    $entity->eca_context = TRUE;
@@ -39,7 +45,12 @@ abstract class ContentEntityBaseEntity extends ContentEntityBase implements Cont
   */
  public function appliesForLazyLoadingWildcard(string $wildcard): bool {
    $entity = $this->getEntity();
    return in_array($wildcard, ['*', $entity->getEntityTypeId(), $entity->getEntityTypeId() . '::' . $entity->bundle()]);
    return in_array($wildcard, [
      '*',
      $entity->getEntityTypeId(),
      $entity->getEntityTypeId() . '::' . $entity->bundle(),
    ]
    );
  }

  /**
+21 −21
Original line number Diff line number Diff line
@@ -8,107 +8,107 @@ namespace Drupal\eca_content\Event;
final class ContentEntityEvents {

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityBundleCreate event.
   * Identifies \Drupal\eca_content\Event\ContentEntityBundleCreate event.
   */
  public const BUNDLECREATE = 'eca.content_entity.bundlecreate';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityBundleDelete event.
   * Identifies \Drupal\eca_content\Event\ContentEntityBundleDelete event.
   */
  public const BUNDLEDELETE = 'eca.content_entity.bundledelete';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityCreate event.
   * Identifies \Drupal\eca_content\Event\ContentEntityCreate event.
   */
  public const CREATE = 'eca.content_entity.create';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityRevisionCreate event.
   * Identifies \Drupal\eca_content\Event\ContentEntityRevisionCreate event.
   */
  public const REVISIONCREATE = 'eca.content_entity.revisioncreate';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityPreLoad event.
   * Identifies \Drupal\eca_content\Event\ContentEntityPreLoad event.
   */
  public const PRELOAD = 'eca.content_entity.preload';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityLoad event.
   * Identifies \Drupal\eca_content\Event\ContentEntityLoad event.
   */
  public const LOAD = 'eca.content_entity.load';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityStorageLoad event.
   * Identifies \Drupal\eca_content\Event\ContentEntityStorageLoad event.
   */
  public const STORAGELOAD = 'eca.content_entity.storageload';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityPreSave event.
   * Identifies \Drupal\eca_content\Event\ContentEntityPreSave event.
   */
  public const PRESAVE = 'eca.content_entity.presave';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityInsert event.
   * Identifies \Drupal\eca_content\Event\ContentEntityInsert event.
   */
  public const INSERT = 'eca.content_entity.insert';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityUpdate event.
   * Identifies \Drupal\eca_content\Event\ContentEntityUpdate event.
   */
  public const UPDATE = 'eca.content_entity.update';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityTranslationCreate event.
   * Identifies \Drupal\eca_content\Event\ContentEntityTranslationCreate event.
   */
  public const TRANSLATIONCREATE = 'eca.content_entity.translationcreate';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityTranslationInsert event.
   * Identifies \Drupal\eca_content\Event\ContentEntityTranslationInsert event.
   */
  public const TRANSLATIONINSERT = 'eca.content_entity.translationsinsert';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityTranslationDelete event.
   * Identifies \Drupal\eca_content\Event\ContentEntityTranslationDelete event.
   */
  public const TRANSLATIONDELETE = 'eca.content_entity.translationdelete';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityPreDelete event.
   * Identifies \Drupal\eca_content\Event\ContentEntityPreDelete event.
   */
  public const PREDELETE = 'eca.content_entity.predelete';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityDelete event.
   * Identifies \Drupal\eca_content\Event\ContentEntityDelete event.
   */
  public const DELETE = 'eca.content_entity.delete';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityRevisionDelete event.
   * Identifies \Drupal\eca_content\Event\ContentEntityRevisionDelete event.
   */
  public const REVISIONDELETE = 'eca.content_entity.revisiondelete';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityView event.
   * Identifies \Drupal\eca_content\Event\ContentEntityView event.
   */
  public const VIEW = 'eca.content_entity.view';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityPrepareView event.
   * Identifies \Drupal\eca_content\Event\ContentEntityPrepareView event.
   */
  public const PREPAREVIEW = 'eca.content_entity.prepareview';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityPrepareForm event.
   * Identifies \Drupal\eca_content\Event\ContentEntityPrepareForm event.
   */
  public const PREPAREFORM = 'eca.content_entity.prepareform';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityFieldValuesInit event.
   * Identifies \Drupal\eca_content\Event\ContentEntityFieldValuesInit event.
   */
  public const FIELDVALUESINIT = 'eca.content_entity.fieldvaluesinit';

  /**
   * Identifier for the \Drupal\eca_content\Event\ContentEntityCustomEvent event.
   * Identifies \Drupal\eca_content\Event\ContentEntityCustomEvent event.
   */
  public const CUSTOM = 'eca.content_entity.custom';

Loading