Commit 8e7a2905 authored by webchick's avatar webchick

Issue #2135689 by Wim Leers: Clean up edit.module to match coding standards.

parent f699ab0b
/**
* @file edit.icons.css
* @file
* Icons for contextual module.
*/
.edit .icon {
......
/**
* @file edit.module.css
* @file
* Generic base styles for edit module.
*
* Note: every class is prefixed with "edit-" to prevent collisions with modules
* or themes. In Edit module-specific DOM subtrees, this is not necessary.
......
/**
* @file edit.theme.css
* @file
* Styling for contextual module.
*/
/**
......
......@@ -16,6 +16,7 @@
* - contextualLinksQueue: queue of contextual links on entities for which it
* is not yet known whether the user has permission to edit at >=1 of them.
*/
(function ($, _, Backbone, Drupal, drupalSettings) {
"use strict";
......
......@@ -2,6 +2,7 @@
* @file
* Form-based in-place editor. Works for any field type.
*/
(function ($, Drupal) {
"use strict";
......
......@@ -2,7 +2,7 @@
* @file
* contentEditable-based in-place editor for plain text content.
*/
(function ($, _, Backbone, Drupal) {
(function ($, _, Drupal) {
"use strict";
......@@ -110,4 +110,4 @@ Drupal.edit.editors.plain_text = Drupal.edit.EditorView.extend({
});
})(jQuery, _, Backbone, Drupal);
})(jQuery, _, Drupal);
(function ($, _, Backbone, Drupal) {
/**
* @file
* A Backbone Model for the state of the in-place editing application.
*
* @see Drupal.edit.AppView
*/
(function (Backbone, Drupal) {
"use strict";
Drupal.edit.AppModel = Backbone.Model.extend({
defaults: {
// The currently state = 'highlighted' Drupal.edit.FieldModel, if any.
// @see Drupal.edit.FieldModel.states
......@@ -14,6 +22,7 @@ Drupal.edit.AppModel = Backbone.Model.extend({
// confirmation.
activeModal: null
}
});
}(jQuery, _, Backbone, Drupal));
}(Backbone, Drupal));
/**
* @file
* A Backbone Model for the state of an in-place editor.
*
* @see Drupal.edit.EditorView
*/
(function (Backbone, Drupal) {
"use strict";
/**
* State of an in-place editor.
*/
Drupal.edit.EditorModel = Backbone.Model.extend({
defaults: {
......
/**
* @file
* A Backbone Model for the state of an in-place editable entity in the DOM.
*/
(function (_, $, Backbone, Drupal) {
"use strict";
/**
* State of an in-place editable entity in the DOM.
*/
Drupal.edit.EntityModel = Backbone.Model.extend({
defaults: {
......
/**
* @file
* A Backbone Model for the state of an in-place editable field in the DOM.
*/
(function (_, Backbone, Drupal) {
"use strict";
......
......@@ -2,6 +2,7 @@
* @file
* Provides overridable theme functions for all of Edit's client-side HTML.
*/
(function ($, Drupal) {
"use strict";
......
......@@ -2,6 +2,7 @@
* @file
* Provides utility functions for Edit.
*/
(function ($, Drupal) {
"use strict";
......@@ -32,6 +33,7 @@ Drupal.edit.util.buildUrl = function (id, urlFormat) {
};
Drupal.edit.util.form = {
/**
* Loads a form, calls a callback to insert.
*
......@@ -118,6 +120,7 @@ Drupal.edit.util.form = {
unajaxifySaving: function (ajax) {
$(ajax.element).off('click.edit');
}
};
})(jQuery, Drupal);
(function ($, _, Backbone, Drupal, drupalSettings) {
/**
* @file
* A Backbone View that controls the overall "in-place editing application".
*
* @see Drupal.edit.AppModel
*/
(function ($, _, Backbone, Drupal) {
"use strict";
......@@ -10,9 +17,6 @@
// makes it impossible for Edit to know where to restore the original HTML.
var reload = false;
/**
*
*/
Drupal.edit.AppView = Backbone.View.extend({
/**
......@@ -490,6 +494,7 @@ Drupal.edit.AppView = Backbone.View.extend({
entityModel.set('state', 'deactivating');
});
}
});
}(jQuery, _, Backbone, Drupal, drupalSettings));
}(jQuery, _, Backbone, Drupal));
/**
* @file
* A Backbone View that a dynamic contextual link.
* A Backbone View that provides a dynamic contextual link.
*/
(function ($, _, Backbone, Drupal) {
(function ($, Backbone, Drupal) {
"use strict";
......@@ -55,4 +56,4 @@ Drupal.edit.ContextualLinkView = Backbone.View.extend({
});
})(jQuery, _, Backbone, Drupal);
})(jQuery, Backbone, Drupal);
......@@ -2,6 +2,7 @@
* @file
* A Backbone View that decorates the in-place edited element.
*/
(function ($, Backbone, Drupal) {
"use strict";
......@@ -346,6 +347,7 @@ Drupal.edit.EditorDecorationView = Backbone.View.extend({
}
return pos;
}
});
})(jQuery, Backbone, Drupal);
(function ($, _, Backbone, Drupal) {
/**
* @file
* An abstract Backbone View that controls an in-place editor.
*/
(function ($, Backbone, Drupal) {
"use strict";
......@@ -10,6 +15,8 @@
*
* Look at Drupal.edit.editors.form and Drupal.edit.editors.plain_text for
* examples.
*
* @see Drupal.edit.EditorModel
*/
Drupal.edit.EditorView = Backbone.View.extend({
......@@ -278,4 +285,4 @@ Drupal.edit.EditorView = Backbone.View.extend({
});
}(jQuery, _, Backbone, Drupal));
}(jQuery, Backbone, Drupal));
(function ($, Backbone) {
/**
* @file
* A Backbone view that decorates the in-place editable entity.
*/
(function (Drupal, $, Backbone) {
"use strict";
......@@ -30,4 +35,4 @@ Drupal.edit.EntityDecorationView = Backbone.View.extend({
});
}(jQuery, Backbone));
}(Drupal, jQuery, Backbone));
......@@ -2,7 +2,8 @@
* @file
* A Backbone View that provides an entity level toolbar.
*/
(function ($, Backbone, Drupal, debounce) {
(function ($, _, Backbone, Drupal, debounce) {
"use strict";
......@@ -439,6 +440,7 @@ Drupal.edit.EntityToolbarView = Backbone.View.extend({
show: function (toolgroup) {
this.$el.removeClass('edit-animate-invisible');
}
});
})(jQuery, Backbone, Drupal, Drupal.debounce);
})(jQuery, _, Backbone, Drupal, Drupal.debounce);
......@@ -2,6 +2,7 @@
* @file
* A Backbone View that provides an interactive toolbar (1 per in-place editor).
*/
(function ($, _, Backbone, Drupal) {
"use strict";
......@@ -181,6 +182,7 @@ Drupal.edit.FieldToolbarView = Backbone.View.extend({
$group.removeClass('edit-animate-invisible');
}, 0);
}
});
})(jQuery, _, Backbone, Drupal);
......@@ -40,7 +40,7 @@ public function __construct($command, $data) {
}
/**
* Implements Drupal\Core\Ajax\CommandInterface:render().
* {@inheritdoc}
*/
public function render() {
return array(
......
......@@ -24,7 +24,7 @@ class InPlaceEditor extends Plugin {
public $id;
/**
* An array of in-place editors that have registered themselves as
* An array of in-place editors plugin IDs that have registered themselves as
* alternatives to this in-place editor.
*
* @var array
......
......@@ -11,10 +11,7 @@
use Drupal\Core\Field\FieldDefinitionInterface;
/**
* Defines an interface for in-place editors (Create.js PropertyEditor widgets).
*
* A PropertyEditor widget is a user-facing interface to edit an entity property
* through Create.js.
* Defines an interface for in-place editors plugins.
*/
interface EditPluginInterface extends PluginInspectionInterface {
......@@ -57,4 +54,5 @@ public function getMetadata(FieldDefinitionInterface $field_definition, array $i
* @see drupal_process_attached()
*/
public function getAttachments();
}
......@@ -41,4 +41,5 @@ public function getEditor($formatter_type, FieldDefinitionInterface $instance, a
* @see drupal_process_attached()
*/
public function getEditorAttachments(array $editor_ids);
}
......@@ -66,7 +66,7 @@ public static function getInfo() {
);
}
function setUp() {
public function setUp() {
parent::setUp();
$type = $this->drupalCreateContentType(array(
......@@ -195,7 +195,6 @@ public function testAutocompleteEdit() {
}
}
/**
* Returns a new term with random name and description in $this->vocabulary.
*
......
......@@ -32,7 +32,7 @@ public static function getInfo() {
);
}
function setUp() {
public function setUp() {
parent::setUp();
// Create a text format.
......
......@@ -24,7 +24,7 @@ class EditTestBase extends DrupalUnitTestBase {
/**
* Sets the default field storage backend for fields created during tests.
*/
function setUp() {
public function setUp() {
parent::setUp();
$this->installSchema('system', 'variable');
......@@ -53,7 +53,7 @@ function setUp() {
* @param array $formatter_settings
* The formatter settings.
*/
function createFieldWithInstance($field_name, $type, $cardinality, $label, $instance_settings, $widget_type, $widget_settings, $formatter_type, $formatter_settings) {
public function createFieldWithInstance($field_name, $type, $cardinality, $label, $instance_settings, $widget_type, $widget_settings, $formatter_type, $formatter_settings) {
$field = $field_name . '_field';
$this->$field = entity_create('field_entity', array(
'name' => $field_name,
......@@ -91,4 +91,5 @@ function createFieldWithInstance($field_name, $type, $cardinality, $label, $inst
))
->save();
}
}
......@@ -37,7 +37,7 @@ public static function getInfo() {
);
}
function setUp() {
public function setUp() {
parent::setUp();
$this->editorManager = $this->container->get('plugin.manager.edit.editor');
......@@ -58,7 +58,7 @@ protected function getSelectedEditor($items, $field_name, $view_mode = 'default'
* Tests a textual field, without/with text processing, with cardinality 1 and
* >1, always without a WYSIWYG editor present.
*/
function testText() {
public function testText() {
$field_name = 'field_text';
$this->createFieldWithInstance(
$field_name, 'text', 1, 'Simple text field',
......@@ -105,7 +105,7 @@ function testText() {
* always with an Editor plugin present that supports textual fields with text
* processing, but with varying text format compatibility.
*/
function testTextWysiwyg() {
public function testTextWysiwyg() {
// Enable edit_test module so that the 'wysiwyg' editor becomes available.
$this->enableModules(array('edit_test'));
......@@ -142,7 +142,7 @@ function testTextWysiwyg() {
/**
* Tests a number field, with cardinality 1 and >1.
*/
function testNumber() {
public function testNumber() {
$field_name = 'field_nr';
$this->createFieldWithInstance(
$field_name, 'number_integer', 1, 'Simple number field',
......
......@@ -54,7 +54,7 @@ public static function getInfo() {
);
}
function setUp() {
public function setUp() {
parent::setUp();
$this->editorManager = $this->container->get('plugin.manager.edit.editor');
......@@ -66,7 +66,7 @@ function setUp() {
/**
* Tests a simple entity type, with two different simple fields.
*/
function testSimpleEntityType() {
public function testSimpleEntityType() {
$field_1_name = 'field_text';
$field_1_label = 'Simple text field';
$this->createFieldWithInstance(
......@@ -125,7 +125,10 @@ function testSimpleEntityType() {
$this->assertEqual($expected_2, $metadata_2, 'The correct metadata is generated for the second field.');
}
function testEditorWithCustomMetadata() {
/**
* Tests a field whose associated in-place editor generates custom metadata.
*/
public function testEditorWithCustomMetadata() {
$this->installSchema('system', 'url_alias');
$this->enableModules(array('user', 'filter'));
......@@ -179,4 +182,5 @@ function testEditorWithCustomMetadata() {
);
$this->assertEqual($expected, $metadata, 'The correct metadata (including custom metadata) is generated.');
}
}
......@@ -3,9 +3,6 @@
/**
* @file
* Contains \Drupal\edit_test\MockEditEntityFieldAccessCheck.
*
* @todo We may want to get rid of this once http://drupal.org/node/1862750
* is done.
*/
namespace Drupal\edit_test;
......@@ -19,7 +16,7 @@
class MockEditEntityFieldAccessCheck implements EditEntityFieldAccessCheckInterface {
/**
* Implements EntityFieldAccessCheckInterface::accessEditEntityField().
* {@inheritdoc}
*/
public function accessEditEntityField(EntityInterface $entity, $field_name) {
return TRUE;
......
......@@ -51,7 +51,7 @@ function getMetadata(FieldDefinitionInterface $field_definition, array $items) {
}
/**
* Implements \Drupal\edit\EditPluginInterface::getAttachments().
* {@inheritdoc}
*/
public function getAttachments() {
return array(
......@@ -60,4 +60,5 @@ public function getAttachments() {
),
);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment