Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
f6dd96ca
Commit
f6dd96ca
authored
Feb 06, 2014
by
Angie Byron
Browse files
Issue
#2175415
by swentel, tim.plunkett, jibran, larowlan: Add FieldTypePluginManagerInterface.
parent
4e2a1c37
Changes
12
Hide whitespace changes
Inline
Side-by-side
core/lib/Drupal/Core/Field/FieldDefinitionInterface.php
View file @
f6dd96ca
...
...
@@ -75,7 +75,7 @@ public function getName();
* @return string
* The field type, i.e. the id of a field type plugin. For example 'text'.
*
* @see \Drupal\Core\Field\FieldTypePluginManager
* @see \Drupal\Core\Field\FieldTypePluginManager
Interface
*/
public
function
getType
();
...
...
core/lib/Drupal/Core/Field/FieldTypePluginManager.php
View file @
f6dd96ca
...
...
@@ -17,7 +17,7 @@
*
* @todo Add FieldTypePluginManagerInterface in https://drupal.org/node/2175415.
*/
class
FieldTypePluginManager
extends
DefaultPluginManager
{
class
FieldTypePluginManager
extends
DefaultPluginManager
implements
FieldTypePluginManagerInterface
{
/**
* {@inheritdoc}
...
...
@@ -62,14 +62,7 @@ public function processDefinition(&$definition, $plugin_id) {
}
/**
* Returns the default field-level settings for a field type.
*
* @param string $type
* A field type name.
*
* @return array
* The type's default settings, as provided by the plugin
* definition, or an empty array if type or settings are undefined.
* {@inheritdoc}
*/
public
function
getDefaultSettings
(
$type
)
{
$info
=
$this
->
getDefinition
(
$type
);
...
...
@@ -77,14 +70,7 @@ public function getDefaultSettings($type) {
}
/**
* Returns the default instance-level settings for a field type.
*
* @param string $type
* A field type name.
*
* @return array
* The instance's default settings, as provided by the plugin
* definition, or an empty array if type or settings are undefined.
* {@inheritdoc}
*/
public
function
getDefaultInstanceSettings
(
$type
)
{
$info
=
$this
->
getDefinition
(
$type
);
...
...
@@ -92,10 +78,7 @@ public function getDefaultInstanceSettings($type) {
}
/**
* Gets the definition of all field types that are configurable.
*
* @return array
* An array of field type definitions.
* {@inheritdoc}
*/
public
function
getConfigurableDefinitions
()
{
$definitions
=
$this
->
getDefinitions
();
...
...
core/lib/Drupal/Core/Field/FieldTypePluginManagerInterface.php
0 → 100644
View file @
f6dd96ca
<?php
/**
* @file
* Contains \Drupal\Core\Field\FieldTypePluginManagerInterface.
*/
namespace
Drupal\Core\Field
;
use
Drupal\Component\Plugin\PluginManagerInterface
;
/**
* Defines an interface for the field type plugin manager.
*/
interface
FieldTypePluginManagerInterface
extends
PluginManagerInterface
{
/**
* Returns the default instance-level settings for a field type.
*
* @param string $type
* A field type name.
*
* @return array
* The instance's default settings, as provided by the plugin definition, or
* an empty array if type or settings are undefined.
*/
public
function
getDefaultInstanceSettings
(
$type
);
/**
* Returns the default field-level settings for a field type.
*
* @param string $type
* A field type name.
*
* @return array
* The type's default settings, as provided by the plugin definition, or an
* empty array if type or settings are undefined.
*/
public
function
getDefaultSettings
(
$type
);
/**
* Gets the definition of all field types that are configurable.
*
* @return array
* An array of field type definitions.
*/
public
function
getConfigurableDefinitions
();
}
core/lib/Drupal/Core/Field/FormatterPluginManager.php
View file @
f6dd96ca
...
...
@@ -28,7 +28,7 @@ class FormatterPluginManager extends DefaultPluginManager {
/**
* The field type manager to define field.
*
* @var \Drupal\Core\Field\FieldTypePluginManager
* @var \Drupal\Core\Field\FieldTypePluginManager
Interface
*/
protected
$fieldTypeManager
;
...
...
@@ -44,10 +44,10 @@ class FormatterPluginManager extends DefaultPluginManager {
* The module handler.
* @param \Drupal\Core\Language\LanguageManager $language_manager
* The language manager.
* @param \Drupal\Core\Field\FieldTypePluginManager $field_type_manager
* @param \Drupal\Core\Field\FieldTypePluginManager
Interface
$field_type_manager
* The 'field type' plugin manager.
*/
public
function
__construct
(
\
Traversable
$namespaces
,
CacheBackendInterface
$cache_backend
,
ModuleHandlerInterface
$module_handler
,
LanguageManager
$language_manager
,
FieldTypePluginManager
$field_type_manager
)
{
public
function
__construct
(
\
Traversable
$namespaces
,
CacheBackendInterface
$cache_backend
,
ModuleHandlerInterface
$module_handler
,
LanguageManager
$language_manager
,
FieldTypePluginManager
Interface
$field_type_manager
)
{
parent
::
__construct
(
'Plugin/Field/FieldFormatter'
,
$namespaces
,
'Drupal\Core\Field\Annotation\FieldFormatter'
);
...
...
core/lib/Drupal/Core/Field/Plugin/DataType/Deriver/FieldItemDeriver.php
View file @
f6dd96ca
...
...
@@ -7,7 +7,7 @@
namespace
Drupal\Core\Field\Plugin\DataType\Deriver
;
use
Drupal\Co
mponent\Plugin\
PluginManagerInterface
;
use
Drupal\Co
re\Field\FieldType
PluginManagerInterface
;
use
Drupal\Core\Plugin\Discovery\ContainerDerivativeInterface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
...
...
@@ -33,7 +33,7 @@ class FieldItemDeriver implements ContainerDerivativeInterface {
/**
* The field type plugin manager.
*
* @var \Drupal\Co
mponent\Plugin\
PluginManagerInterface
* @var \Drupal\Co
re\Field\FieldType
PluginManagerInterface
*/
protected
$fieldTypePluginManager
;
...
...
@@ -42,10 +42,10 @@ class FieldItemDeriver implements ContainerDerivativeInterface {
*
* @param string $base_plugin_id
* The base plugin ID.
* @param \Drupal\Co
mponent\Plugin\
PluginManagerInterface $field_type_
plugin_
manager
* @param \Drupal\Co
re\Field\FieldType
PluginManagerInterface $field_type_manager
* The field type plugin manager.
*/
public
function
__construct
(
$base_plugin_id
,
PluginManagerInterface
$field_type_plugin_manager
)
{
public
function
__construct
(
$base_plugin_id
,
FieldType
PluginManagerInterface
$field_type_plugin_manager
)
{
$this
->
basePluginId
=
$base_plugin_id
;
$this
->
fieldTypePluginManager
=
$field_type_plugin_manager
;
}
...
...
core/lib/Drupal/Core/Field/WidgetPluginManager.php
View file @
f6dd96ca
...
...
@@ -21,7 +21,7 @@ class WidgetPluginManager extends DefaultPluginManager {
/**
* The field type manager to define field.
*
* @var \Drupal\Core\Field\FieldTypePluginManager
* @var \Drupal\Core\Field\FieldTypePluginManager
Interface
*/
protected
$fieldTypeManager
;
...
...
@@ -44,10 +44,10 @@ class WidgetPluginManager extends DefaultPluginManager {
* The module handler.
* @param \Drupal\Core\Language\LanguageManager $language_manager
* The language manager.
* @param \Drupal\Core\Field\FieldTypePluginManager $field_type_manager
* @param \Drupal\Core\Field\FieldTypePluginManager
Interface
$field_type_manager
* The 'field type' plugin manager.
*/
public
function
__construct
(
\
Traversable
$namespaces
,
CacheBackendInterface
$cache_backend
,
ModuleHandlerInterface
$module_handler
,
LanguageManager
$language_manager
,
FieldTypePluginManager
$field_type_manager
)
{
public
function
__construct
(
\
Traversable
$namespaces
,
CacheBackendInterface
$cache_backend
,
ModuleHandlerInterface
$module_handler
,
LanguageManager
$language_manager
,
FieldTypePluginManager
Interface
$field_type_manager
)
{
parent
::
__construct
(
'Plugin/Field/FieldWidget'
,
$namespaces
,
'Drupal\Core\Field\Annotation\FieldWidget'
);
$this
->
setCacheBackend
(
$cache_backend
,
$language_manager
,
'field_widget_types_plugins'
);
...
...
core/modules/field/lib/Drupal/field/FieldInfo.php
View file @
f6dd96ca
...
...
@@ -10,10 +10,8 @@
use
Drupal\Core\Cache\Cache
;
use
Drupal\Core\Cache\CacheBackendInterface
;
use
Drupal\Core\Config\ConfigFactory
;
use
Drupal\Core\Field\FieldTypePluginManager
;
use
Drupal\Core\Field\FieldTypePluginManager
Interface
;
use
Drupal\Core\Extension\ModuleHandlerInterface
;
use
Drupal\field\FieldInterface
;
use
Drupal\field\FieldInstanceInterface
;
/**
* Provides field and instance definitions for the current runtime environment.
...
...
@@ -51,7 +49,7 @@ class FieldInfo {
/**
* The field type manager to define field.
*
* @var \Drupal\Core\Field\FieldTypePluginManager
* @var \Drupal\Core\Field\FieldTypePluginManager
Interface
*/
protected
$fieldTypeManager
;
...
...
@@ -134,10 +132,10 @@ class FieldInfo {
* The configuration factory object to use.
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler class to use for invoking hooks.
* @param \Drupal\Core\Field\FieldTypePluginManager $field_type_manager
* @param \Drupal\Core\Field\FieldTypePluginManager
Interface
$field_type_manager
* The 'field type' plugin manager.
*/
public
function
__construct
(
CacheBackendInterface
$cache_backend
,
ConfigFactory
$config
,
ModuleHandlerInterface
$module_handler
,
FieldTypePluginManager
$field_type_manager
)
{
public
function
__construct
(
CacheBackendInterface
$cache_backend
,
ConfigFactory
$config
,
ModuleHandlerInterface
$module_handler
,
FieldTypePluginManager
Interface
$field_type_manager
)
{
$this
->
cacheBackend
=
$cache_backend
;
$this
->
moduleHandler
=
$module_handler
;
$this
->
config
=
$config
;
...
...
core/modules/field_ui/lib/Drupal/field_ui/DisplayOverviewBase.php
View file @
f6dd96ca
...
...
@@ -11,7 +11,7 @@
use
Drupal\Core\Entity\Display\EntityDisplayInterface
;
use
Drupal\Core\Entity\EntityManagerInterface
;
use
Drupal\Core\Field\FieldDefinitionInterface
;
use
Drupal\Core\Field\FieldTypePluginManager
;
use
Drupal\Core\Field\FieldTypePluginManager
Interface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
...
...
@@ -45,12 +45,12 @@ abstract class DisplayOverviewBase extends OverviewBase {
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Field\FieldTypePluginManager $field_type_manager
* @param \Drupal\Core\Field\FieldTypePluginManager
Interface
$field_type_manager
* The field type manager.
* @param \Drupal\Component\Plugin\PluginManagerBase $plugin_manager
* The widget or formatter plugin manager.
*/
public
function
__construct
(
EntityManagerInterface
$entity_manager
,
FieldTypePluginManager
$field_type_manager
,
PluginManagerBase
$plugin_manager
)
{
public
function
__construct
(
EntityManagerInterface
$entity_manager
,
FieldTypePluginManager
Interface
$field_type_manager
,
PluginManagerBase
$plugin_manager
)
{
parent
::
__construct
(
$entity_manager
);
$this
->
fieldTypes
=
$field_type_manager
->
getConfigurableDefinitions
();
...
...
core/modules/field_ui/lib/Drupal/field_ui/FieldListController.php
View file @
f6dd96ca
...
...
@@ -11,7 +11,7 @@
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\Core\Entity\EntityManagerInterface
;
use
Drupal\Core\Entity\EntityTypeInterface
;
use
Drupal\Core\Field\FieldTypePluginManager
;
use
Drupal\Core\Field\FieldTypePluginManager
Interface
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
/**
...
...
@@ -43,7 +43,7 @@ class FieldListController extends ConfigEntityListController {
/**
* The field type manager.
*
* @var \Drupal\Core\Field\FieldTypePluginManager
* @var \Drupal\Core\Field\FieldTypePluginManager
Interface
*/
protected
$fieldTypeManager
;
...
...
@@ -54,10 +54,10 @@ class FieldListController extends ConfigEntityListController {
* The entity info for the entity type.
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Field\FieldTypePluginManager $field_type_manager
* @param \Drupal\Core\Field\FieldTypePluginManager
Interface
$field_type_manager
* The 'field type' plugin manager.
*/
public
function
__construct
(
EntityTypeInterface
$entity_info
,
EntityManagerInterface
$entity_manager
,
FieldTypePluginManager
$field_type_manager
)
{
public
function
__construct
(
EntityTypeInterface
$entity_info
,
EntityManagerInterface
$entity_manager
,
FieldTypePluginManager
Interface
$field_type_manager
)
{
parent
::
__construct
(
$entity_info
,
$entity_manager
->
getStorageController
(
$entity_info
->
id
()));
$this
->
entityManager
=
$entity_manager
;
...
...
core/modules/field_ui/lib/Drupal/field_ui/FieldOverview.php
View file @
f6dd96ca
...
...
@@ -8,8 +8,8 @@
namespace
Drupal\field_ui
;
use
Drupal\Core\Entity\EntityManagerInterface
;
use
Drupal\Core\Field\FieldTypePluginManager
;
use
Drupal\Core\Extension\ModuleHandlerInterface
;
use
Drupal\Core\Field\FieldTypePluginManagerInterface
;
use
Drupal\field_ui
\
OverviewBase
;
use
Symfony\Component\DependencyInjection\ContainerInterface
;
use
Drupal\field\Entity\Field
;
...
...
@@ -22,7 +22,7 @@ class FieldOverview extends OverviewBase {
/**
* The field type manager.
*
* @var \Drupal\Core\Field\FieldTypePluginManager
* @var \Drupal\Core\Field\FieldTypePluginManager
Interface
*/
protected
$fieldTypeManager
;
...
...
@@ -38,12 +38,12 @@ class FieldOverview extends OverviewBase {
*
* @param \Drupal\Core\Entity\EntityManagerInterface $entity_manager
* The entity manager.
* @param \Drupal\Core\Field\FieldTypePluginManager $field_type_manager
* @param \Drupal\Core\Field\FieldTypePluginManager
Interface
$field_type_manager
* The field type manager
* @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
* The module handler to invoke hooks on.
*/
public
function
__construct
(
EntityManagerInterface
$entity_manager
,
FieldTypePluginManager
$field_type_manager
,
ModuleHandlerInterface
$module_handler
)
{
public
function
__construct
(
EntityManagerInterface
$entity_manager
,
FieldTypePluginManager
Interface
$field_type_manager
,
ModuleHandlerInterface
$module_handler
)
{
parent
::
__construct
(
$entity_manager
);
$this
->
fieldTypeManager
=
$field_type_manager
;
$this
->
moduleHandler
=
$module_handler
;
...
...
core/tests/Drupal/Tests/Core/Entity/FieldDefinitionTest.php
View file @
f6dd96ca
...
...
@@ -46,10 +46,7 @@ public static function getInfo() {
*/
public
function
setUp
()
{
// Mock the field type manager and place it in the container.
// @todo Add FieldTypePluginManagerInterface in https://drupal.org/node/2175415.
$field_type_manager
=
$this
->
getMockBuilder
(
'Drupal\Core\Field\FieldTypePluginManager'
)
->
disableOriginalConstructor
()
->
getMock
();
$field_type_manager
=
$this
->
getMock
(
'Drupal\Core\Field\FieldTypePluginManagerInterface'
);
$this
->
fieldType
=
$this
->
randomName
();
$this
->
fieldTypeDefinition
=
array
(
...
...
core/tests/Drupal/Tests/Core/Entity/FieldableDatabaseStorageControllerTest.php
View file @
f6dd96ca
...
...
@@ -40,10 +40,7 @@ public static function getInfo() {
* @see \Drupal\Core\Entity\Controller\FieldableDatabaseStorageController::_fieldSqlSchema()
*/
public
function
testFieldSqlSchemaForEntityWithStringIdentifier
()
{
// @todo Add FieldTypePluginManagerInterface in https://drupal.org/node/2175415.
$field_type_manager
=
$this
->
getMockBuilder
(
'Drupal\Core\Field\FieldTypePluginManager'
)
->
disableOriginalConstructor
()
->
getMock
();
$field_type_manager
=
$this
->
getMock
(
'Drupal\Core\Field\FieldTypePluginManagerInterface'
);
$entity_manager
=
$this
->
getMock
(
'\Drupal\Core\Entity\EntityManagerInterface'
);
$container
=
new
ContainerBuilder
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment