Move into nested docroot

This commit is contained in:
Rob Davies 2017-02-13 15:31:17 +00:00
parent 83a0d3a149
commit c8b70abde9
13405 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,35 @@
<?php
namespace Drupal\quickedit\Plugin\InPlaceEditor;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\quickedit\Plugin\InPlaceEditorBase;
/**
* Defines the form in-place editor.
*
* @InPlaceEditor(
* id = "form"
* )
*/
class FormEditor extends InPlaceEditorBase {
/**
* {@inheritdoc}
*/
public function isCompatible(FieldItemListInterface $items) {
return TRUE;
}
/**
* {@inheritdoc}
*/
public function getAttachments() {
return array(
'library' => array(
'quickedit/quickedit.inPlaceEditor.form',
),
);
}
}

View file

@ -0,0 +1,38 @@
<?php
namespace Drupal\quickedit\Plugin\InPlaceEditor;
use Drupal\Core\Field\FieldItemListInterface;
use Drupal\quickedit\Plugin\InPlaceEditorBase;
/**
* Defines the plain text in-place editor.
*
* @InPlaceEditor(
* id = "plain_text"
* )
*/
class PlainTextEditor extends InPlaceEditorBase {
/**
* {@inheritdoc}
*/
public function isCompatible(FieldItemListInterface $items) {
$field_definition = $items->getFieldDefinition();
// This editor is incompatible with multivalued fields.
return $field_definition->getFieldStorageDefinition()->getCardinality() == 1;
}
/**
* {@inheritdoc}
*/
public function getAttachments() {
return array(
'library' => array(
'quickedit/quickedit.inPlaceEditor.plainText',
),
);
}
}

View file

@ -0,0 +1,25 @@
<?php
namespace Drupal\quickedit\Plugin;
use Drupal\Core\Plugin\PluginBase;
use Drupal\Core\Field\FieldItemListInterface;
/**
* Defines a base in-place editor implementation.
*
* @see \Drupal\quickedit\Annotation\InPlaceEditor
* @see \Drupal\quickedit\Plugin\InPlaceEditorInterface
* @see \Drupal\quickedit\Plugin\InPlaceEditorManager
* @see plugin_api
*/
abstract class InPlaceEditorBase extends PluginBase implements InPlaceEditorInterface {
/**
* {@inheritdoc}
*/
function getMetadata(FieldItemListInterface $items) {
return array();
}
}

View file

@ -0,0 +1,54 @@
<?php
namespace Drupal\quickedit\Plugin;
use Drupal\Component\Plugin\PluginInspectionInterface;
use Drupal\Core\Field\FieldItemListInterface;
/**
* Defines an interface for in-place editors plugins.
*
* @see \Drupal\quickedit\Annotation\InPlaceEditor
* @see \Drupal\quickedit\Plugin\InPlaceEditorBase
* @see \Drupal\quickedit\Plugin\InPlaceEditorManager
* @see plugin_api
*/
interface InPlaceEditorInterface extends PluginInspectionInterface {
/**
* Checks whether this in-place editor is compatible with a given field.
*
* @param \Drupal\Core\Field\FieldItemListInterface $items
* The field values to be in-place edited.
*
* @return bool
* TRUE if it is compatible, FALSE otherwise.
*/
public function isCompatible(FieldItemListInterface $items);
/**
* Generates metadata that is needed specifically for this editor.
*
* Will only be called by \Drupal\quickedit\MetadataGeneratorInterface::generate()
* when the passed in field & item values will use this editor.
*
* @param \Drupal\Core\Field\FieldItemListInterface $items
* The field values to be in-place edited.
*
* @return array
* A keyed array with metadata. Each key should be prefixed with the plugin
* ID of the editor.
*/
public function getMetadata(FieldItemListInterface $items);
/**
* Returns the attachments for this editor.
*
* @return array
* An array of attachments, for use with #attached.
*
* @see \Drupal\Core\Render\AttachmentsResponseProcessorInterface::processAttachments()
*/
public function getAttachments();
}

View file

@ -0,0 +1,38 @@
<?php
namespace Drupal\quickedit\Plugin;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
/**
* Provides an in-place editor manager.
*
* The 'form' in-place editor must always be available.
*
* @see \Drupal\quickedit\Annotation\InPlaceEditor
* @see \Drupal\quickedit\Plugin\InPlaceEditorBase
* @see \Drupal\quickedit\Plugin\InPlaceEditorInterface
* @see plugin_api
*/
class InPlaceEditorManager extends DefaultPluginManager {
/**
* Constructs a InPlaceEditorManager object.
*
* @param \Traversable $namespaces
* An object that implements \Traversable which contains the root paths
* keyed by the corresponding namespace to look for plugin implementations.
* @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
* Cache backend instance to use.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler to invoke the alter hook with.
*/
public function __construct(\Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
parent::__construct('Plugin/InPlaceEditor', $namespaces, $module_handler, 'Drupal\quickedit\Plugin\InPlaceEditorInterface', 'Drupal\quickedit\Annotation\InPlaceEditor');
$this->alterInfo('quickedit_editor');
$this->setCacheBackend($cache_backend, 'quickedit:editor');
}
}