Commit 5a0f9cad authored by Ra Mänd's avatar Ra Mänd
Browse files

Coding standard fixes.

parent fa9405c2
......@@ -43,10 +43,10 @@ function field_collection_field_collection_from_field_get_children($plugin, $par
$child_plugin['title'] = t(
'!label field collection (!field_name) from !entity_type (!bundle)',
array(
'!label' => $instance['label'],
'!field_name' => $instance['field_name'],
'!entity_type' => $instance['entity_type'],
'!bundle' => $instance['bundle']
'!label' => $instance['label'],
'!field_name' => $instance['field_name'],
'!entity_type' => $instance['entity_type'],
'!bundle' => $instance['bundle'],
)
);
$restrictions = array('type' => array($instance['bundle']));
......
......@@ -5,8 +5,8 @@
* Default theme implementation for field collection items.
*
* Available variables:
* - $content: An array of comment items. Use render($content) to print them all, or
* print a subset such as render($content['field_example']). Use
* - $content: An array of comment items. Use render($content) to print them
* all, or print a subset such as render($content['field_example']). Use
* hide($content['field_example']) to temporarily suppress the printing of a
* given element.
* - $title: The (sanitized) field collection item label.
......
......@@ -12,7 +12,11 @@ function field_collections_overview() {
$instances = field_info_instances();
$field_types = field_info_field_types();
$bundles = field_info_bundles();
$header = array(t('Field name'), t('Used in'), array('data' => t('Operations'), 'colspan' => '2'));
$header = array(
t('Field name'),
t('Used in'),
array('data' => t('Operations'), 'colspan' => '2'),
);
$rows = array();
foreach ($instances as $entity_type => $type_bundles) {
foreach ($type_bundles as $bundle => $bundle_instances) {
......
......@@ -16,7 +16,7 @@
* This hook allows modules to determine whether a field collection is empty
* before it is saved.
*
* @param boolean $empty
* @param bool $is_empty
* Whether or not the field should be considered empty.
* @param FieldCollectionItemEntity $item
* The field collection we are currently operating on.
......@@ -182,7 +182,7 @@ function hook_field_collection_item_label($item, $host, $field) {
case 'field_my_first_collection':
$item_wrapper = entity_metadata_wrapper('field_collection_item', $item);
$title = $item_wrapper->field_title->value();
$title = $item_wrapper->field_title->value();
$author = $item_wrapper->field_author->value();
return "{$title} by {$author}";
......
......@@ -27,4 +27,4 @@ class FieldCollectionItemMetadataController extends EntityDefaultMetadataControl
return $info;
}
}
\ No newline at end of file
}
......@@ -124,7 +124,7 @@ function field_collection_update_7001() {
->expression('revision_id', 'item_id')
->execute();
// Add the archived column
// Add the archived column.
$archived_spec = array(
'description' => 'Boolean indicating whether the field collection item is archived.',
'type' => 'int',
......@@ -365,7 +365,7 @@ function field_collection_update_7008() {
if ($field['translatable'] == 1 && isset($field['bundles']['field_collection_item'])) {
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'field_collection_item')
->fieldLanguageCondition($f_name, LANGUAGE_NONE);
->fieldLanguageCondition($f_name, LANGUAGE_NONE);
$query_result = $query->execute();
if (isset($query_result['field_collection_item'])) {
$results = $results + $query_result['field_collection_item'];
......
......@@ -84,7 +84,7 @@ class MigrateDestinationFieldCollection extends MigrateDestinationEntity {
* @param $row
* Raw source data object - passed through to prepare/complete handlers.
*
* @return array|false
* @return array|bool
* Array of key fields (item_id only in this case) of the collection that
* was saved or FALSE on failure.
*/
......@@ -126,7 +126,7 @@ class MigrateDestinationFieldCollection extends MigrateDestinationEntity {
$this->prepare($entity, $row);
// Restore fields from original field_collection_item if updating
// Restore fields from original field_collection_item if updating.
if ($updating) {
foreach ($entity as $field => $value) {
if ('field_' != substr($field, 0, 6)) {
......@@ -177,6 +177,7 @@ class MigrateDestinationFieldCollection extends MigrateDestinationEntity {
$this->completeRollback($item_id);
return TRUE;
}
}
/**
......
......@@ -40,7 +40,7 @@ function field_collection_form_alter(&$form, &$form_state) {
*/
function field_collection_form_field_ui_field_overview_form_alter(&$form, &$form_state) {
if (count($form['#fields'])) {
foreach($form['fields'] as $fieldname => $field) {
foreach ($form['fields'] as $fieldname => $field) {
if (!isset($field['type']['#title'])) {
continue;
}
......@@ -87,7 +87,7 @@ function field_collection_entity_info() {
'full' => array(
'label' => t('Full content'),
'custom settings' => FALSE,
),
),
),
'access callback' => 'field_collection_item_access',
'deletion callback' => 'field_collection_item_delete',
......@@ -145,7 +145,7 @@ function field_collection_entity_info() {
* @param $entity_type
* @param $entity
*
* @return
* @return string
* A language code
*/
function field_collection_entity_language($entity_type, $entity) {
......@@ -172,7 +172,7 @@ function field_collection_field_name_load($arg) {
/**
* Loads a field collection item.
*
* @return field_collection_item
* @return
* The field collection item entity or FALSE.
*/
function field_collection_item_load($item_id, $reset = FALSE) {
......@@ -322,7 +322,7 @@ function field_collection_admin_paths() {
*/
function field_collection_permission() {
return array(
'administer field collections' => array(
'administer field collections' => array(
'title' => t('Administer field collections'),
'description' => t('Create and delete fields on field collections.'),
),
......@@ -558,7 +558,7 @@ function field_collection_field_update($host_entity_type, $host_entity, $field,
if (!isset($cleared_host_entity_cache)) {
list($entity_id) = entity_extract_ids($host_entity_type, $host_entity);
entity_get_controller($host_entity_type)->resetCache(array($entity_id));
$cleared_host_entity_cache = true;
$cleared_host_entity_cache = TRUE;
}
$is_default = entity_revision_is_default($host_entity_type, $host_entity);
// If an entity type does not support saving non-default entities,
......@@ -761,7 +761,7 @@ function field_collection_field_formatter_info() {
'field_collection_list' => array(
'label' => t('Links to field collection items'),
'field types' => array('field_collection'),
'settings' => array(
'settings' => array(
'edit' => t('Edit'),
'translate' => t('Translate'),
'delete' => t('Delete'),
......@@ -772,7 +772,7 @@ function field_collection_field_formatter_info() {
'field_collection_view' => array(
'label' => t('Field collection items'),
'field types' => array('field_collection'),
'settings' => array(
'settings' => array(
'edit' => t('Edit'),
'translate' => t('Translate'),
'delete' => t('Delete'),
......@@ -784,7 +784,7 @@ function field_collection_field_formatter_info() {
'field_collection_fields' => array(
'label' => t('Fields only'),
'field types' => array('field_collection'),
'settings' => array(
'settings' => array(
'view_mode' => 'full',
),
),
......@@ -875,7 +875,7 @@ function field_collection_field_formatter_settings_summary($field, $instance, $v
if ($display['type'] !== 'field_collection_list') {
$entity_type = entity_get_info('field_collection_item');
if (!empty($entity_type['view modes'][$settings['view_mode']]['label'])) {
$output[] = t('View mode: @mode', array('@mode' => $entity_type['view modes'][$settings['view_mode']]['label']));
$output[] = t('View mode: @mode', array('@mode' => $entity_type['view modes'][$settings['view_mode']]['label']));
}
}
......
......@@ -23,7 +23,11 @@ class FieldCollectionBasicTestCase extends DrupalWebTestCase {
// Create a field_collection field to use for the tests.
$this->field_name = 'field_test_collection';
$this->field = array('field_name' => $this->field_name, 'type' => 'field_collection', 'cardinality' => 4);
$this->field = array(
'field_name' => $this->field_name,
'type' => 'field_collection',
'cardinality' => 4,
);
$this->field = field_create_field($this->field);
$this->field_id = $this->field['id'];
......@@ -83,7 +87,8 @@ class FieldCollectionBasicTestCase extends DrupalWebTestCase {
* Message to display.
* @param $group
* The group this message belongs to, defaults to 'Other'.
* @return
*
* @return bool
* TRUE on pass, FALSE on fail.
*/
protected function assertNoHookMessage($text, $message = NULL, $group = 'Other') {
......@@ -282,7 +287,7 @@ class FieldCollectionBasicTestCase extends DrupalWebTestCase {
$this->assertTrue($item->archived, 'Removed field collection item is archived.');
// Test removing an old node revision. Make sure that the field collection
// is not removed
// is not removed.
list ($node, $item) = $this->createNodeWithFieldCollection();
$node_vid = $node->vid;
$node->revision = TRUE;
......@@ -714,9 +719,10 @@ class FieldCollectionEntityTranslationTestCase extends DrupalWebTestCase {
}
/**
* Install a specified language if it has not been already, otherwise make sure that the language is enabled.
* Install a specified language if it has not been already, otherwise make
* sure that the language is enabled.
*
* @param $langcode
* @param string $langcode
* The language code to check.
*/
function addLanguage($langcode) {
......@@ -887,11 +893,11 @@ class FieldCollectionEntityTranslationTestCase extends DrupalWebTestCase {
/**
* Create a translation using the Entity Translation Form.
*
* @param $node
* @param mixed $node
* Node of the basic page to create translation for.
* @param $langcode
* @param string $langcode
* The language code of the translation.
* @param $source_langcode
* @param string $source_langcode
* The original language code.
*/
protected function createTranslationForm($node, $langcode, $source_langcode = 'en') {
......@@ -947,9 +953,9 @@ class FieldCollectionEntityTranslationTestCase extends DrupalWebTestCase {
*
* @param mixed $node
* The node to remove the translation from.
* @param unknown $langcode
* @param string $langcode
* The language of the translation to remove.
* @param unknown $source_langcode
* @param string $source_langcode
* The source language of the node.
*/
protected function removeTranslationForm($node, $langcode, $source_langcode) {
......@@ -981,12 +987,10 @@ class FieldCollectionEntityTranslationTestCase extends DrupalWebTestCase {
/**
* Creates a translation programmatically using Entity Translation.
*
* @param $node
* @param mixed $node
* Node of the basic page to create translation for.
* @param $langcode
* @param string $langcode
* The language code of the translation.
* @param $source_langcode
* The source language code.
*/
protected function createTranslation($node, $langcode) {
$source_langcode = $node->language;
......@@ -1023,7 +1027,7 @@ class FieldCollectionEntityTranslationTestCase extends DrupalWebTestCase {
field_attach_update('node', $node);
// Reload an return the node.
$node = node_load($node->nid, null, TRUE);
$node = node_load($node->nid, NULL, TRUE);
return $node;
}
......@@ -1032,7 +1036,7 @@ class FieldCollectionEntityTranslationTestCase extends DrupalWebTestCase {
*
* @param mixed $node
* The node to remove the translation from.
* @param unknown $langcode
* @param string $langcode
* The language of the translation to remove.
*/
protected function removeTranslation($node, $langcode) {
......@@ -1044,7 +1048,7 @@ class FieldCollectionEntityTranslationTestCase extends DrupalWebTestCase {
node_save($node);
// Reload and return the node.
$node = node_load($node->nid, null, TRUE);
$node = node_load($node->nid, NULL, TRUE);
return $node;
}
......@@ -1052,10 +1056,14 @@ class FieldCollectionEntityTranslationTestCase extends DrupalWebTestCase {
/**
* Creates a new revision of the node and checks the result.
*
* @param $node
* @param $langcode
* @param $source_langcode
* @return
* @param mixed $node
* The node to remove the translation from.
* @param string $langcode
* The language of the translation to remove.
* @param string $source_langcode
* The source language of the node.
*
* @return mixed
* The new revision of the node.
*/
protected function createRevision($node, $langcode, $source_langcode) {
......@@ -1089,11 +1097,12 @@ class FieldCollectionEntityTranslationTestCase extends DrupalWebTestCase {
* The language to check.
*/
protected function checkFieldCollectionContent($node, $langcode) {
switch($langcode) {
switch ($langcode) {
case 'en':
$untrans_field = self::UNTRANS_FIELD_EN;
$trans_field = self::TRANS_FIELD_EN;
break;
case 'de':
$untrans_field = self::UNTRANS_FIELD_DE;
$trans_field = self::TRANS_FIELD_DE;
......
......@@ -44,7 +44,11 @@ function field_collection_field_views_data($field) {
}
$data['field_collection_item'][$pseudo_field_name]['relationship'] = array(
'title' => t('Entity with the @field (@field_name)', array('@entity' => $entity, '@field' => $label, '@field_name' => $field['field_name'])),
'title' => t('Entity with the @field (@field_name)', array(
'@entity' => $entity,
'@field' => $label,
'@field_name' => $field['field_name'],
)),
'help' => t('Relate each @entity using @field.', array('@entity' => $entity, '@field' => $label)),
'handler' => 'views_handler_relationship_entity_reverse',
'field_name' => $field['field_name'],
......
......@@ -55,4 +55,5 @@ class field_collection_handler_relationship extends views_handler_relationship {
}
return $this->table_alias;
}
}
Supports Markdown
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