Skip to content
Snippets Groups Projects
Select Git revision
  • fdf3858b27b6a482d79b5842551047ae23a5dbd4
  • 11.x default protected
  • 11.2.x protected
  • 10.5.x protected
  • 10.6.x protected
  • 11.1.x protected
  • 10.4.x protected
  • 11.0.x protected
  • 10.3.x protected
  • 7.x protected
  • 10.2.x protected
  • 10.1.x protected
  • 9.5.x protected
  • 10.0.x protected
  • 9.4.x protected
  • 9.3.x protected
  • 9.2.x protected
  • 9.1.x protected
  • 8.9.x protected
  • 9.0.x protected
  • 8.8.x protected
  • 10.5.1 protected
  • 11.2.2 protected
  • 11.2.1 protected
  • 11.2.0 protected
  • 10.5.0 protected
  • 11.2.0-rc2 protected
  • 10.5.0-rc1 protected
  • 11.2.0-rc1 protected
  • 10.4.8 protected
  • 11.1.8 protected
  • 10.5.0-beta1 protected
  • 11.2.0-beta1 protected
  • 11.2.0-alpha1 protected
  • 10.4.7 protected
  • 11.1.7 protected
  • 10.4.6 protected
  • 11.1.6 protected
  • 10.3.14 protected
  • 10.4.5 protected
  • 11.0.13 protected
41 results

edit_test.module

Blame
  • webchick's avatar
    Issue #2057973 by aspilicious, Wim Leers: Don't add Edit module's data-...
    Angie Byron authored
    Issue #2057973 by aspilicious, Wim Leers: Don't add Edit module's data- attributes on pseudo fields (as used e.g. by Display Suite).
    fdf3858b
    History
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    edit_test.module 1014 B
    <?php
    
    /**
     * @file
     * Helper module for the Edit tests.
     */
    
    use Drupal\Core\Language\Language;
    use Drupal\Core\Entity\EntityInterface;
    use Drupal\entity\Entity\EntityDisplay;
    
    /**
     * Implements hook_entity_view_alter().
     */
    function edit_test_entity_view_alter(&$build, EntityInterface $entity, EntityDisplay $display) {
      if ($entity->entityType() == 'node' && $entity->bundle() == 'article') {
        $build['pseudo'] = array(
          '#theme' => 'field',
          '#title' => 'My pseudo field',
          '#field_name' => 'edit_test_pseudo_field',
          '#label_display' => 'Label',
          '#entity_type' => $entity->entityType(),
          '#bundle' => $entity->bundle(),
          '#language' => Language::LANGCODE_NOT_SPECIFIED,
          '#field_type' => 'pseudo',
          '#view_mode' => 'default',
          '#object' => $entity,
          '#access' => TRUE,
          '#items' => array(
            0 => array(
              'value' => 'pseudo field',
            ),
          ),
          0 => array(
            '#markup' => 'pseudo field',
          ),
        );
      }
    }