Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176

This commit is contained in:
Pantheon Automation 2015-08-17 17:00:26 -07:00 committed by Greg Anderson
commit 9921556621
13277 changed files with 1459781 additions and 0 deletions

View file

@ -0,0 +1,6 @@
name: 'Quick Edit test'
type: module
description: 'Support module for the Quick Edit module tests.'
core: 8.x
package: Testing
version: VERSION

View file

@ -0,0 +1,52 @@
<?php
/**
* @file
* Helper module for the Quick Edit tests.
*/
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Language\LanguageInterface;
/**
* Implements hook_entity_view_alter().
*/
function quickedit_test_entity_view_alter(&$build, EntityInterface $entity, EntityViewDisplayInterface $display) {
if ($entity->getEntityTypeId() == 'node' && $entity->bundle() == 'article') {
$build['pseudo'] = array(
'#theme' => 'field',
'#title' => 'My pseudo field',
'#field_name' => 'quickedit_test_pseudo_field',
'#label_display' => 'Label',
'#entity_type' => $entity->getEntityTypeId(),
'#bundle' => $entity->bundle(),
'#language' => LanguageInterface::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',
),
);
}
}
/**
* Implements hook_quickedit_render_field().
*/
function quickedit_test_quickedit_render_field(EntityInterface $entity, $field_name, $view_mode_id, $langcode) {
$entity = \Drupal::entityManager()->getTranslationFromContext($entity, $langcode);
return array(
'#prefix' => '<div class="quickedit-test-wrapper">',
'field' => $entity->get($field_name)->view($view_mode_id),
'#suffix' => '</div>',
);
}

View file

@ -0,0 +1,25 @@
<?php
/**
* @file
* Contains \Drupal\quickedit_test\MockEditEntityFieldAccessCheck.
*/
namespace Drupal\quickedit_test;
use Drupal\Core\Entity\EntityInterface;
use Drupal\quickedit\Access\EditEntityFieldAccessCheckInterface;
/**
* Access check for editing entity fields.
*/
class MockEditEntityFieldAccessCheck implements EditEntityFieldAccessCheckInterface {
/**
* {@inheritdoc}
*/
public function accessEditEntityField(EntityInterface $entity, $field_name) {
return TRUE;
}
}

View file

@ -0,0 +1,63 @@
<?php
/**
* @file
* Contains \Drupal\quickedit_test\Plugin\InPlaceEditor\WysiwygEditor.
*/
namespace Drupal\quickedit_test\Plugin\InPlaceEditor;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\quickedit\Plugin\InPlaceEditorBase;
/**
* Defines the 'wysiwyg' in-place editor.
*
* @InPlaceEditor(
* id = "wysiwyg",
* alternativeTo = {"plain_text"}
* )
*/
class WysiwygEditor extends InPlaceEditorBase {
/**
* {@inheritdoc}
*/
public function isCompatible(FieldItemListInterface $items) {
$field_definition = $items->getFieldDefinition();
// This editor is incompatible with multivalued fields.
if ($field_definition->getFieldStorageDefinition()->getCardinality() != 1) {
return FALSE;
}
// This editor is compatible with formatted ("rich") text fields; but only
// if there is a currently active text format and that text format is the
// 'full_html' text format.
elseif (in_array($field_definition->getType(), array('text', 'text_long', 'text_with_summary'), TRUE)) {
if ($items[0]->format === 'full_html') {
return TRUE;
}
return FALSE;
}
}
/**
* {@inheritdoc}
*/
public function getMetadata(FieldItemListInterface $items) {
$metadata['format'] = $items[0]->format;
return $metadata;
}
/**
* {@inheritdoc}
*/
public function getAttachments() {
return array(
'library' => array(
'quickedit_test/not-existing-wysiwyg',
),
);
}
}