Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
fe01ab6e
Commit
fe01ab6e
authored
May 07, 2012
by
catch
Browse files
Issue
#1542682
by Berdir: Convert exception classes in field.module to
PSR-0
.
parent
1bd03e00
Changes
15
Hide whitespace changes
Inline
Side-by-side
core/modules/field/field.api.php
View file @
fe01ab6e
...
...
@@ -5,6 +5,8 @@
* @{
*/
use
Drupal\field\FieldUpdateForbiddenException
;
/**
* Exposes "pseudo-field" components on fieldable entities.
*
...
...
@@ -2434,7 +2436,8 @@ function hook_field_create_instance($instance) {
* semantics, or if there are external dependencies on field settings
* that cannot be updated.
*
* To forbid the update from occurring, throw a FieldUpdateForbiddenException.
* To forbid the update from occurring, throw a
* Drupal\field\FieldUpdateForbiddenException.
*
* @param $field
* The field as it will be post-update.
...
...
core/modules/field/field.attach.inc
View file @
fe01ab6e
...
...
@@ -5,29 +5,7 @@
* Field attach API, allowing entities (nodes, users, ...) to be 'fieldable'.
*/
/**
* Exception thrown by field_attach_validate() on field validation errors.
*/
class
FieldValidationException
extends
FieldException
{
var
$errors
;
/**
* Constructor for FieldValidationException.
*
* @param $errors
* An array of field validation errors, keyed by field name and
* delta that contains two keys:
* - 'error': A machine-readable error code string, prefixed by
* the field module name. A field widget may use this code to decide
* how to report the error.
* - 'message': A human-readable error message such as to be
* passed to form_error() for the appropriate form element.
*/
function
__construct
(
$errors
)
{
$this
->
errors
=
$errors
;
parent
::
__construct
(
t
(
'Field validation errors'
));
}
}
use
Drupal\field\FieldValidationException
;
/**
* @defgroup field_storage Field Storage API
...
...
@@ -765,7 +743,7 @@ function field_attach_load_revision($entity_type, $entities, $options = array())
* The type of $entity; e.g. 'node' or 'user'.
* @param $entity
* The entity with fields to validate.
* @throws FieldValidationException
* @throws
Drupal\field\
FieldValidationException
* If validation errors are found, a FieldValidationException is thrown. The
* 'errors' property contains the array of errors, keyed by field name,
* language and delta.
...
...
core/modules/field/field.crud.inc
View file @
fe01ab6e
...
...
@@ -5,6 +5,8 @@
* Field CRUD API, handling field and field instance creation and deletion.
*/
use
Drupal\field\FieldException
;
/**
* @defgroup field_crud Field CRUD API
* @{
...
...
@@ -49,7 +51,7 @@
* @return
* The $field array with the id property filled in.
*
* @throws FieldException
* @throws
Drupal\field\
FieldException
*
* See: @link field Field API data structures @endlink.
*/
...
...
@@ -213,8 +215,9 @@ function field_create_field($field) {
* structure. Any other properties of the field that are not
* specified in $field will be left unchanged, so it is not
* necessary to pass in a fully populated $field structure.
* @return
* Throws a FieldException if the update cannot be performed.
*
* @throws Drupal\field\FieldException
*
* @see field_create_field()
*/
function
field_update_field
(
$field
)
{
...
...
@@ -447,7 +450,7 @@ function field_delete_field($field_name) {
* @return
* The $instance array with the id property filled in.
*
* @throws FieldException
* @throws
Drupal\field\
FieldException
*
* See: @link field Field API data structures @endlink.
*/
...
...
@@ -514,7 +517,7 @@ function field_create_instance($instance) {
* properties specified in $instance overwrite the existing values for
* the instance.
*
* @throws FieldException
* @throws
Drupal\field\
FieldException
*
* @see field_create_instance()
*/
...
...
core/modules/field/field.module
View file @
fe01ab6e
...
...
@@ -4,14 +4,6 @@
* Attach custom data fields to Drupal entities.
*/
/**
* Base class for all exceptions thrown by Field API functions.
*
* This class has no functionality of its own other than allowing all
* Field API exceptions to be caught by a single catch block.
*/
class
FieldException
extends
Exception
{}
/*
* Load all public Field API functions. Drupal currently has no
* mechanism for auto-loading core APIs, so we have to load them on
...
...
@@ -273,11 +265,6 @@ class FieldException extends Exception {}
*/
const
FIELD_LOAD_REVISION
=
'FIELD_LOAD_REVISION'
;
/**
* Exception class thrown by hook_field_update_forbid().
*/
class
FieldUpdateForbiddenException
extends
FieldException
{}
/**
* Implements hook_help().
*/
...
...
core/modules/field/lib/Drupal/field/FieldException.php
0 → 100644
View file @
fe01ab6e
<?php
/*
* @file
* Definition of Drupal\field\FieldExeption.
*/
namespace
Drupal\field
;
use
RuntimeException
;
/**
* Base class for all exceptions thrown by Field API functions.
*
* This class has no functionality of its own other than allowing all
* Field API exceptions to be caught by a single catch block.
*/
class
FieldException
extends
RuntimeException
{}
core/modules/field/lib/Drupal/field/FieldUpdateForbiddenException.php
0 → 100644
View file @
fe01ab6e
<?php
/*
* @file
* Definition of Drupal\field\FieldUpdateForbiddenException.
*/
namespace
Drupal\field
;
/**
* Exception class thrown by hook_field_update_forbid().
*/
class
FieldUpdateForbiddenException
extends
FieldException
{}
core/modules/field/lib/Drupal/field/FieldValidationException.php
0 → 100644
View file @
fe01ab6e
<?php
/*
* @file
* Definition of Drupal\field\FieldValidationExeption.
*/
namespace
Drupal\field
;
/**
* Exception thrown by field_attach_validate() on field validation errors.
*/
class
FieldValidationException
extends
FieldException
{
/**
* An array of field validation errors.
*
* @var array
*/
public
$errors
;
/**
* Constructor for FieldValidationException.
*
* @param $errors
* An array of field validation errors, keyed by field name and
* delta that contains two keys:
* - 'error': A machine-readable error code string, prefixed by
* the field module name. A field widget may use this code to decide
* how to report the error.
* - 'message': A human-readable error message such as to be
* passed to form_error() for the appropriate form element.
*/
function
__construct
(
$errors
)
{
$this
->
errors
=
$errors
;
parent
::
__construct
(
t
(
'Field validation errors'
));
}
}
core/modules/field/modules/field_sql_storage/field_sql_storage.module
View file @
fe01ab6e
...
...
@@ -2,6 +2,7 @@
use
Drupal\Core\Database\Database
;
use
Drupal\Core\Database\Query\Select
;
use
Drupal\field\FieldUpdateForbiddenException
;
/**
* @file
...
...
core/modules/field/modules/field_sql_storage/field_sql_storage.test
View file @
fe01ab6e
<?php
use
Drupal\Core\Database\Database
;
use
Drupal\field\FieldException
;
/**
* @file
...
...
core/modules/field/modules/list/list.module
View file @
fe01ab6e
...
...
@@ -5,6 +5,8 @@
* Defines list field types that can be used with the Options module.
*/
use
Drupal\field\FieldUpdateForbiddenException
;
/**
* Implements hook_help().
*/
...
...
core/modules/field/modules/list/tests/list.test
View file @
fe01ab6e
...
...
@@ -5,6 +5,9 @@
* Tests for list.module.
*/
use
Drupal\field\FieldException
;
use
Drupal\field\FieldValidationException
;
/**
* Tests for the 'List' field types.
*/
...
...
core/modules/field/modules/text/text.test
View file @
fe01ab6e
...
...
@@ -5,6 +5,8 @@
* Tests for text.module.
*/
use
Drupal\field\FieldValidationException
;
class
TextFieldTestCase
extends
DrupalWebTestCase
{
protected
$instance
;
protected
$admin_user
;
...
...
core/modules/field/tests/field.test
View file @
fe01ab6e
...
...
@@ -5,6 +5,9 @@
* Tests for field.module.
*/
use
Drupal\field\FieldException
;
use
Drupal\field\FieldValidationException
;
/**
* Parent class for Field API tests.
*/
...
...
core/modules/field/tests/field_test.field.inc
View file @
fe01ab6e
...
...
@@ -5,6 +5,8 @@
* Defines a field type and its formatters and widgets.
*/
use
Drupal\field\FieldException
;
/**
* Implements hook_field_info().
*/
...
...
core/modules/taxonomy/taxonomy.test
View file @
fe01ab6e
...
...
@@ -5,6 +5,8 @@
* Tests for taxonomy.module.
*/
use
Drupal\field\FieldValidationException
;
/**
* Provides common helper methods for Taxonomy module tests.
*/
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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