Skip to content

Instantly share code, notes, and snippets.

@Renrhaf
Created August 17, 2016 15:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Renrhaf/2e76675037ed817f684db81b7a8ef5a2 to your computer and use it in GitHub Desktop.
Save Renrhaf/2e76675037ed817f684db81b7a8ef5a2 to your computer and use it in GitHub Desktop.
AFOUND-607
From 4f5e6797849313e8207d26e520bf995177805eaa Mon Sep 17 00:00:00 2001
From: lsantos-oq <luis.santos@openquest.pt>
Date: Fri, 4 Mar 2016 18:15:36 +0000
Subject: [PATCH 01/11] AFOUND-607 Create the content type
---
modules/features/foundation_videop/README.md | 4 +
.../foundation_videop.features.field_base.inc | 110 +++++++
.../foundation_videop.features.field_instance.inc | 319 +++++++++++++++++++++
.../foundation_videop/foundation_videop.info | 20 ++
.../foundation_videop/foundation_videop.module | 5 +
5 files changed, 458 insertions(+)
create mode 100644 modules/features/foundation_videop/README.md
create mode 100644 modules/features/foundation_videop/foundation_videop.features.field_base.inc
create mode 100644 modules/features/foundation_videop/foundation_videop.features.field_instance.inc
create mode 100644 modules/features/foundation_videop/foundation_videop.info
create mode 100644 modules/features/foundation_videop/foundation_videop.module
diff --git a/modules/features/foundation_videop/README.md b/modules/features/foundation_videop/README.md
new file mode 100644
index 0000000..1ac0045
--- /dev/null
+++ b/modules/features/foundation_videop/README.md
@@ -0,0 +1,4 @@
+Foundation Video Page
+==============
+
+Feature defining the content type for Video Page.
diff --git a/modules/features/foundation_videop/foundation_videop.features.field_base.inc b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
new file mode 100644
index 0000000..ca4fd8b
--- /dev/null
+++ b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
@@ -0,0 +1,110 @@
+<?php
+/**
+ * @file
+ * foundation_videop.features.field_base.inc
+ */
+
+/**
+ * Implements hook_field_default_field_bases().
+ */
+function foundation_videop_field_default_field_bases() {
+ $field_bases = array();
+
+ // Exported field_base: 'field_fvideop_background'.
+ $field_bases['field_fvideop_background'] = array(
+ 'active' => 1,
+ 'cardinality' => 1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvideop_background',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'sid' => array(
+ 0 => 'sid',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ ),
+ 'translatable' => 1,
+ 'type' => 'atom_reference',
+ );
+
+ // Exported field_base: 'field_fvideop_bonus_videos'.
+ $field_bases['field_fvideop_bonus_videos'] = array(
+ 'active' => 1,
+ 'cardinality' => -1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvideop_bonus_videos',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'sid' => array(
+ 0 => 'sid',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ ),
+ 'translatable' => 1,
+ 'type' => 'atom_reference',
+ );
+
+ // Exported field_base: 'field_fvideop_gallery'.
+ $field_bases['field_fvideop_gallery'] = array(
+ 'active' => 1,
+ 'cardinality' => 1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvideop_gallery',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'sid' => array(
+ 0 => 'sid',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ ),
+ 'translatable' => 1,
+ 'type' => 'atom_reference',
+ );
+
+ // Exported field_base: 'field_fvideop_video'.
+ $field_bases['field_fvideop_video'] = array(
+ 'active' => 1,
+ 'cardinality' => 1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvideop_video',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'sid' => array(
+ 0 => 'sid',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ ),
+ 'translatable' => 1,
+ 'type' => 'atom_reference',
+ );
+
+ return $field_bases;
+}
diff --git a/modules/features/foundation_videop/foundation_videop.features.field_instance.inc b/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
new file mode 100644
index 0000000..83e55fa
--- /dev/null
+++ b/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
@@ -0,0 +1,319 @@
+<?php
+/**
+ * @file
+ * foundation_videop.features.field_instance.inc
+ */
+
+/**
+ * Implements hook_field_default_field_instances().
+ */
+function foundation_videop_field_default_field_instances() {
+ $field_instances = array();
+
+ // Exported field_instance: 'node-fvideop-body'.
+ $field_instances['node-fvideop-body'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'hidden',
+ 'module' => 'text',
+ 'settings' => array(),
+ 'type' => 'text_default',
+ 'weight' => 1,
+ ),
+ 'teaser' => array(
+ 'label' => 'hidden',
+ 'module' => 'text',
+ 'settings' => array(
+ 'trim_length' => 600,
+ ),
+ 'type' => 'text_summary_or_trimmed',
+ 'weight' => 1,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'body',
+ 'label' => 'Editorial Text',
+ 'required' => 0,
+ 'settings' => array(
+ 'context' => 'title',
+ 'context_default' => 'sdl_editor_representation',
+ 'display_summary' => 1,
+ 'dnd_enabled' => 1,
+ 'entity_translation_sync' => FALSE,
+ 'mee_enabled' => 1,
+ 'text_processing' => 1,
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'text',
+ 'settings' => array(
+ 'rows' => 20,
+ 'summary_rows' => 5,
+ ),
+ 'type' => 'text_textarea_with_summary',
+ 'weight' => 1,
+ ),
+ );
+
+ // Exported field_instance: 'node-fvideop-field_fvideop_background'.
+ $field_instances['node-fvideop-field_fvideop_background'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'link' => 0,
+ 'override' => 0,
+ ),
+ 'type' => 'title',
+ 'weight' => 4,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvideop_background',
+ 'label' => 'Background',
+ 'required' => 0,
+ 'settings' => array(
+ 'allow_override' => 0,
+ 'entity_translation_sync' => FALSE,
+ 'referencable_types' => array(
+ 'gallery' => 0,
+ 'iframe' => 0,
+ 'image' => 'image',
+ 'video' => 0,
+ ),
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'context' => 'sdl_editor_representation',
+ ),
+ 'type' => 'atom_reference_textfield',
+ 'weight' => 9,
+ ),
+ );
+
+ // Exported field_instance: 'node-fvideop-field_fvideop_bonus_videos'.
+ $field_instances['node-fvideop-field_fvideop_bonus_videos'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'link' => 0,
+ 'override' => 0,
+ ),
+ 'type' => 'title',
+ 'weight' => 6,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvideop_bonus_videos',
+ 'label' => 'Bonus videos',
+ 'required' => 0,
+ 'settings' => array(
+ 'allow_override' => 0,
+ 'entity_translation_sync' => FALSE,
+ 'referencable_types' => array(
+ 'gallery' => 0,
+ 'iframe' => 0,
+ 'image' => 0,
+ 'video' => 'video',
+ ),
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'context' => 'sdl_editor_representation',
+ ),
+ 'type' => 'atom_reference_textfield',
+ 'weight' => 11,
+ ),
+ );
+
+ // Exported field_instance: 'node-fvideop-field_fvideop_gallery'.
+ $field_instances['node-fvideop-field_fvideop_gallery'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'link' => 0,
+ 'override' => 0,
+ ),
+ 'type' => 'title',
+ 'weight' => 5,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvideop_gallery',
+ 'label' => 'Gallery',
+ 'required' => 0,
+ 'settings' => array(
+ 'allow_override' => 0,
+ 'entity_translation_sync' => FALSE,
+ 'referencable_types' => array(
+ 'gallery' => 'gallery',
+ 'iframe' => 0,
+ 'image' => 0,
+ 'video' => 0,
+ ),
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'context' => 'sdl_editor_representation',
+ ),
+ 'type' => 'atom_reference_textfield',
+ 'weight' => 10,
+ ),
+ );
+
+ // Exported field_instance: 'node-fvideop-field_fvideop_video'.
+ $field_instances['node-fvideop-field_fvideop_video'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'link' => 0,
+ 'override' => 0,
+ ),
+ 'type' => 'title',
+ 'weight' => 3,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvideop_video',
+ 'label' => 'Video',
+ 'required' => 1,
+ 'settings' => array(
+ 'allow_override' => 0,
+ 'entity_translation_sync' => FALSE,
+ 'referencable_types' => array(
+ 'gallery' => 0,
+ 'iframe' => 0,
+ 'image' => 0,
+ 'video' => 'video',
+ ),
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'context' => 'sdl_editor_representation',
+ ),
+ 'type' => 'atom_reference_textfield',
+ 'weight' => 8,
+ ),
+ );
+
+ // Exported field_instance: 'node-fvideop-title_field'.
+ $field_instances['node-fvideop-title_field'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 2,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'title_field',
+ 'label' => 'Titre',
+ 'required' => TRUE,
+ 'settings' => array(
+ 'context' => '',
+ 'dnd_enabled' => 0,
+ 'entity_translation_sync' => FALSE,
+ 'hide_label' => array(
+ 'entity' => FALSE,
+ 'page' => FALSE,
+ ),
+ 'mee_enabled' => 0,
+ 'text_processing' => 0,
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'module' => 'text',
+ 'settings' => array(
+ 'size' => 60,
+ ),
+ 'type' => 'text_textfield',
+ 'weight' => 0,
+ ),
+ );
+
+ // Translatables
+ // Included for use with string extractors like potx.
+ t('Background');
+ t('Bonus videos');
+ t('Editorial Text');
+ t('Gallery');
+ t('Titre');
+ t('Video');
+
+ return $field_instances;
+}
diff --git a/modules/features/foundation_videop/foundation_videop.info b/modules/features/foundation_videop/foundation_videop.info
new file mode 100644
index 0000000..14e2eaf
--- /dev/null
+++ b/modules/features/foundation_videop/foundation_videop.info
@@ -0,0 +1,20 @@
+name = Foundation Video Page
+core = 7.x
+package = Features
+version = 7.x-1.0
+dependencies[] = alw_fields
+dependencies[] = alw_videop
+dependencies[] = atom_reference
+dependencies[] = features
+dependencies[] = text
+features[features_api][] = api:2
+features[field_base][] = field_fvideop_background
+features[field_base][] = field_fvideop_bonus_videos
+features[field_base][] = field_fvideop_gallery
+features[field_base][] = field_fvideop_video
+features[field_instance][] = node-fvideop-body
+features[field_instance][] = node-fvideop-field_fvideop_background
+features[field_instance][] = node-fvideop-field_fvideop_bonus_videos
+features[field_instance][] = node-fvideop-field_fvideop_gallery
+features[field_instance][] = node-fvideop-field_fvideop_video
+features[field_instance][] = node-fvideop-title_field
diff --git a/modules/features/foundation_videop/foundation_videop.module b/modules/features/foundation_videop/foundation_videop.module
new file mode 100644
index 0000000..44788b0
--- /dev/null
+++ b/modules/features/foundation_videop/foundation_videop.module
@@ -0,0 +1,5 @@
+<?php
+/**
+ * @file
+ * Drupal needs this blank file.
+ */
From c460b322699245c23d50a07f6c8dbde3d21c3ca2 Mon Sep 17 00:00:00 2001
From: lsantos-oq <luis.santos@openquest.pt>
Date: Fri, 4 Mar 2016 18:46:37 +0000
Subject: [PATCH 02/11] AFOUND-607 Node configuration and new fields
---
.../foundation_videop.features.field_base.inc | 175 +++++++++++
.../foundation_videop.features.field_instance.inc | 331 ++++++++++++++++++++-
.../foundation_videop.features.inc | 32 ++
.../foundation_videop/foundation_videop.info | 28 +-
.../foundation_videop/foundation_videop.module | 4 +-
.../foundation_videop.strongarm.inc | 89 ++++++
6 files changed, 652 insertions(+), 7 deletions(-)
create mode 100644 modules/features/foundation_videop/foundation_videop.features.inc
create mode 100644 modules/features/foundation_videop/foundation_videop.strongarm.inc
diff --git a/modules/features/foundation_videop/foundation_videop.features.field_base.inc b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
index ca4fd8b..660e791 100644
--- a/modules/features/foundation_videop/foundation_videop.features.field_base.inc
+++ b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
@@ -58,6 +58,30 @@ function foundation_videop_field_default_field_bases() {
'type' => 'atom_reference',
);
+ // Exported field_base: 'field_fvideop_desc_hl'.
+ $field_bases['field_fvideop_desc_hl'] = array(
+ 'active' => 1,
+ 'cardinality' => 1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvideop_desc_hl',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'format' => array(
+ 0 => 'format',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'text',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ ),
+ 'translatable' => 1,
+ 'type' => 'text_long',
+ );
+
// Exported field_base: 'field_fvideop_gallery'.
$field_bases['field_fvideop_gallery'] = array(
'active' => 1,
@@ -82,6 +106,105 @@ function foundation_videop_field_default_field_bases() {
'type' => 'atom_reference',
);
+ // Exported field_base: 'field_fvideop_section_content'.
+ $field_bases['field_fvideop_section_content'] = array(
+ 'active' => 1,
+ 'cardinality' => 1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvideop_section_content',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'format' => array(
+ 0 => 'format',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'text',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ ),
+ 'translatable' => 1,
+ 'type' => 'text_long',
+ );
+
+ // Exported field_base: 'field_fvideop_section_title'.
+ $field_bases['field_fvideop_section_title'] = array(
+ 'active' => 1,
+ 'cardinality' => 1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvideop_section_title',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'format' => array(
+ 0 => 'format',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'text',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ 'max_length' => 255,
+ ),
+ 'translatable' => 1,
+ 'type' => 'text',
+ );
+
+ // Exported field_base: 'field_fvideop_social_headline'.
+ $field_bases['field_fvideop_social_headline'] = array(
+ 'active' => 1,
+ 'cardinality' => 1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvideop_social_headline',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'format' => array(
+ 0 => 'format',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'text',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ 'max_length' => 255,
+ ),
+ 'translatable' => 1,
+ 'type' => 'text',
+ );
+
+ // Exported field_base: 'field_fvideop_subtitle'.
+ $field_bases['field_fvideop_subtitle'] = array(
+ 'active' => 1,
+ 'cardinality' => 1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvideop_subtitle',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'format' => array(
+ 0 => 'format',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'text',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ 'max_length' => 255,
+ ),
+ 'translatable' => 1,
+ 'type' => 'text',
+ );
+
// Exported field_base: 'field_fvideop_video'.
$field_bases['field_fvideop_video'] = array(
'active' => 1,
@@ -106,5 +229,57 @@ function foundation_videop_field_default_field_bases() {
'type' => 'atom_reference',
);
+ // Exported field_base: 'field_fvideop_video_teaser'.
+ $field_bases['field_fvideop_video_teaser'] = array(
+ 'active' => 1,
+ 'cardinality' => 1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvideop_video_teaser',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'sid' => array(
+ 0 => 'sid',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ ),
+ 'translatable' => 1,
+ 'type' => 'atom_reference',
+ );
+
+ // Exported field_base: 'field_xiti_chapters'.
+ $field_bases['field_xiti_chapters'] = array(
+ 'active' => 1,
+ 'cardinality' => -1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_xiti_chapters',
+ 'indexes' => array(
+ 'tid' => array(
+ 0 => 'tid',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'taxonomy',
+ 'settings' => array(
+ 'allowed_values' => array(
+ 0 => array(
+ 'vocabulary' => 'xiti_chapters',
+ 'parent' => 0,
+ ),
+ ),
+ 'entity_translation_sync' => FALSE,
+ 'options_list_callback' => 'i18n_taxonomy_allowed_values',
+ ),
+ 'translatable' => 0,
+ 'type' => 'taxonomy_term_reference',
+ );
+
return $field_bases;
}
diff --git a/modules/features/foundation_videop/foundation_videop.features.field_instance.inc b/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
index 83e55fa..87a1a6f 100644
--- a/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
+++ b/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
@@ -56,7 +56,7 @@ function foundation_videop_field_default_field_instances() {
'summary_rows' => 5,
),
'type' => 'text_textarea_with_summary',
- 'weight' => 1,
+ 'weight' => 2,
),
);
@@ -106,7 +106,7 @@ function foundation_videop_field_default_field_instances() {
'context' => 'sdl_editor_representation',
),
'type' => 'atom_reference_textfield',
- 'weight' => 9,
+ 'weight' => 8,
),
);
@@ -156,7 +156,52 @@ function foundation_videop_field_default_field_instances() {
'context' => 'sdl_editor_representation',
),
'type' => 'atom_reference_textfield',
- 'weight' => 11,
+ 'weight' => 7,
+ ),
+ );
+
+ // Exported field_instance: 'node-fvideop-field_fvideop_desc_hl'.
+ $field_instances['node-fvideop-field_fvideop_desc_hl'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'text',
+ 'settings' => array(),
+ 'type' => 'text_default',
+ 'weight' => 8,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvideop_desc_hl',
+ 'label' => 'Description / Headline',
+ 'required' => 0,
+ 'settings' => array(
+ 'context' => 'title',
+ 'context_default' => 'sdl_editor_representation',
+ 'dnd_enabled' => 1,
+ 'entity_translation_sync' => FALSE,
+ 'mee_enabled' => 1,
+ 'text_processing' => 0,
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'text',
+ 'settings' => array(
+ 'rows' => 5,
+ ),
+ 'type' => 'text_textarea',
+ 'weight' => 5,
),
);
@@ -206,10 +251,190 @@ function foundation_videop_field_default_field_instances() {
'context' => 'sdl_editor_representation',
),
'type' => 'atom_reference_textfield',
+ 'weight' => 6,
+ ),
+ );
+
+ // Exported field_instance: 'node-fvideop-field_fvideop_section_content'.
+ $field_instances['node-fvideop-field_fvideop_section_content'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'text',
+ 'settings' => array(),
+ 'type' => 'text_default',
+ 'weight' => 11,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvideop_section_content',
+ 'label' => 'Section content',
+ 'required' => 0,
+ 'settings' => array(
+ 'context' => 'title',
+ 'context_default' => 'sdl_editor_representation',
+ 'dnd_enabled' => 1,
+ 'entity_translation_sync' => FALSE,
+ 'mee_enabled' => 1,
+ 'text_processing' => 1,
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'text',
+ 'settings' => array(
+ 'rows' => 5,
+ ),
+ 'type' => 'text_textarea',
'weight' => 10,
),
);
+ // Exported field_instance: 'node-fvideop-field_fvideop_section_title'.
+ $field_instances['node-fvideop-field_fvideop_section_title'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'text',
+ 'settings' => array(),
+ 'type' => 'text_default',
+ 'weight' => 10,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvideop_section_title',
+ 'label' => 'Section title',
+ 'required' => 0,
+ 'settings' => array(
+ 'context' => 'title',
+ 'context_default' => 'sdl_editor_representation',
+ 'dnd_enabled' => 0,
+ 'entity_translation_sync' => FALSE,
+ 'mee_enabled' => 0,
+ 'text_processing' => 0,
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'text',
+ 'settings' => array(
+ 'size' => 60,
+ ),
+ 'type' => 'text_textfield',
+ 'weight' => 9,
+ ),
+ );
+
+ // Exported field_instance: 'node-fvideop-field_fvideop_social_headline'.
+ $field_instances['node-fvideop-field_fvideop_social_headline'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'text',
+ 'settings' => array(),
+ 'type' => 'text_default',
+ 'weight' => 9,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvideop_social_headline',
+ 'label' => 'Social Headline',
+ 'required' => 0,
+ 'settings' => array(
+ 'context' => 'title',
+ 'context_default' => 'sdl_editor_representation',
+ 'dnd_enabled' => 0,
+ 'entity_translation_sync' => FALSE,
+ 'mee_enabled' => 0,
+ 'text_processing' => 0,
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'text',
+ 'settings' => array(
+ 'size' => 60,
+ ),
+ 'type' => 'text_textfield',
+ 'weight' => 11,
+ ),
+ );
+
+ // Exported field_instance: 'node-fvideop-field_fvideop_subtitle'.
+ $field_instances['node-fvideop-field_fvideop_subtitle'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'text',
+ 'settings' => array(),
+ 'type' => 'text_default',
+ 'weight' => 12,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvideop_subtitle',
+ 'label' => 'Subtitle',
+ 'required' => 0,
+ 'settings' => array(
+ 'context' => 'title',
+ 'context_default' => 'sdl_editor_representation',
+ 'dnd_enabled' => 0,
+ 'entity_translation_sync' => FALSE,
+ 'mee_enabled' => 0,
+ 'text_processing' => 0,
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'text',
+ 'settings' => array(
+ 'size' => 60,
+ ),
+ 'type' => 'text_textfield',
+ 'weight' => 4,
+ ),
+ );
+
// Exported field_instance: 'node-fvideop-field_fvideop_video'.
$field_instances['node-fvideop-field_fvideop_video'] = array(
'bundle' => 'fvideop',
@@ -256,7 +481,97 @@ function foundation_videop_field_default_field_instances() {
'context' => 'sdl_editor_representation',
),
'type' => 'atom_reference_textfield',
- 'weight' => 8,
+ 'weight' => 3,
+ ),
+ );
+
+ // Exported field_instance: 'node-fvideop-field_fvideop_video_teaser'.
+ $field_instances['node-fvideop-field_fvideop_video_teaser'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'link' => 0,
+ 'override' => 0,
+ ),
+ 'type' => 'title',
+ 'weight' => 7,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvideop_video_teaser',
+ 'label' => 'Video teaser',
+ 'required' => 0,
+ 'settings' => array(
+ 'allow_override' => 0,
+ 'entity_translation_sync' => FALSE,
+ 'referencable_types' => array(
+ 'gallery' => 0,
+ 'iframe' => 0,
+ 'image' => 0,
+ 'video' => 'video',
+ ),
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'context' => 'sdl_editor_representation',
+ ),
+ 'type' => 'atom_reference_textfield',
+ 'weight' => 1,
+ ),
+ );
+
+ // Exported field_instance: 'node-fvideop-field_xiti_chapters'.
+ $field_instances['node-fvideop-field_xiti_chapters'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => 'Enter Xiti chapters one by one, separated by a comma. Please, do not enter all chapters at once.<br/>Format : parent, child, second-child',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'i18n_taxonomy',
+ 'settings' => array(),
+ 'type' => 'i18n_taxonomy_term_reference_link',
+ 'weight' => 0,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_xiti_chapters',
+ 'label' => 'Xiti chapters',
+ 'required' => FALSE,
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'module' => 'taxonomy',
+ 'settings' => array(
+ 'autocomplete_path' => 'taxonomy/autocomplete',
+ 'size' => 60,
+ ),
+ 'type' => 'taxonomy_autocomplete',
+ 'weight' => 12,
),
);
@@ -310,10 +625,18 @@ function foundation_videop_field_default_field_instances() {
// Included for use with string extractors like potx.
t('Background');
t('Bonus videos');
+ t('Description / Headline');
t('Editorial Text');
+ t('Enter Xiti chapters one by one, separated by a comma. Please, do not enter all chapters at once.<br/>Format : parent, child, second-child');
t('Gallery');
+ t('Section content');
+ t('Section title');
+ t('Social Headline');
+ t('Subtitle');
t('Titre');
t('Video');
+ t('Video teaser');
+ t('Xiti chapters');
return $field_instances;
}
diff --git a/modules/features/foundation_videop/foundation_videop.features.inc b/modules/features/foundation_videop/foundation_videop.features.inc
new file mode 100644
index 0000000..ea7d016
--- /dev/null
+++ b/modules/features/foundation_videop/foundation_videop.features.inc
@@ -0,0 +1,32 @@
+<?php
+/**
+ * @file
+ * foundation_videop.features.inc
+ */
+
+/**
+ * Implements hook_ctools_plugin_api().
+ */
+function foundation_videop_ctools_plugin_api($module = NULL, $api = NULL) {
+ if ($module == "strongarm" && $api == "strongarm") {
+ return array("version" => "1");
+ }
+}
+
+/**
+ * Implements hook_node_info().
+ */
+function foundation_videop_node_info() {
+ $items = array(
+ 'fvideop' => array(
+ 'name' => t('Video Page'),
+ 'base' => 'node_content',
+ 'description' => t('The is the program / detail page of a video, that will be publicly accessible.'),
+ 'has_title' => '1',
+ 'title_label' => t('Title'),
+ 'help' => '',
+ ),
+ );
+ drupal_alter('node_info', $items);
+ return $items;
+}
diff --git a/modules/features/foundation_videop/foundation_videop.info b/modules/features/foundation_videop/foundation_videop.info
index 14e2eaf..92767a3 100644
--- a/modules/features/foundation_videop/foundation_videop.info
+++ b/modules/features/foundation_videop/foundation_videop.info
@@ -2,19 +2,43 @@ name = Foundation Video Page
core = 7.x
package = Features
version = 7.x-1.0
-dependencies[] = alw_fields
-dependencies[] = alw_videop
dependencies[] = atom_reference
+dependencies[] = ctools
dependencies[] = features
+dependencies[] = node
+dependencies[] = strongarm
dependencies[] = text
+features[ctools][] = strongarm:strongarm:1
features[features_api][] = api:2
features[field_base][] = field_fvideop_background
features[field_base][] = field_fvideop_bonus_videos
+features[field_base][] = field_fvideop_desc_hl
features[field_base][] = field_fvideop_gallery
+features[field_base][] = field_fvideop_section_content
+features[field_base][] = field_fvideop_section_title
+features[field_base][] = field_fvideop_social_headline
+features[field_base][] = field_fvideop_subtitle
features[field_base][] = field_fvideop_video
+features[field_base][] = field_fvideop_video_teaser
+features[field_base][] = field_xiti_chapters
features[field_instance][] = node-fvideop-body
features[field_instance][] = node-fvideop-field_fvideop_background
features[field_instance][] = node-fvideop-field_fvideop_bonus_videos
+features[field_instance][] = node-fvideop-field_fvideop_desc_hl
features[field_instance][] = node-fvideop-field_fvideop_gallery
+features[field_instance][] = node-fvideop-field_fvideop_section_content
+features[field_instance][] = node-fvideop-field_fvideop_section_title
+features[field_instance][] = node-fvideop-field_fvideop_social_headline
+features[field_instance][] = node-fvideop-field_fvideop_subtitle
features[field_instance][] = node-fvideop-field_fvideop_video
+features[field_instance][] = node-fvideop-field_fvideop_video_teaser
+features[field_instance][] = node-fvideop-field_xiti_chapters
features[field_instance][] = node-fvideop-title_field
+features[node][] = fvideop
+features[variable][] = field_bundle_settings_node__fvideop
+features[variable][] = language_content_type_fvideop
+features[variable][] = menu_options_fvideop
+features[variable][] = menu_parent_fvideop
+features[variable][] = node_options_fvideop
+features[variable][] = node_preview_fvideop
+features[variable][] = node_submitted_fvideop
diff --git a/modules/features/foundation_videop/foundation_videop.module b/modules/features/foundation_videop/foundation_videop.module
index 44788b0..14c5607 100644
--- a/modules/features/foundation_videop/foundation_videop.module
+++ b/modules/features/foundation_videop/foundation_videop.module
@@ -1,5 +1,7 @@
<?php
/**
* @file
- * Drupal needs this blank file.
+ * Code for the Foundation Video Page feature.
*/
+
+include_once 'foundation_videop.features.inc';
diff --git a/modules/features/foundation_videop/foundation_videop.strongarm.inc b/modules/features/foundation_videop/foundation_videop.strongarm.inc
new file mode 100644
index 0000000..8c7b660
--- /dev/null
+++ b/modules/features/foundation_videop/foundation_videop.strongarm.inc
@@ -0,0 +1,89 @@
+<?php
+/**
+ * @file
+ * foundation_videop.strongarm.inc
+ */
+
+/**
+ * Implements hook_strongarm().
+ */
+function foundation_videop_strongarm() {
+ $export = array();
+
+ $strongarm = new stdClass();
+ $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
+ $strongarm->api_version = 1;
+ $strongarm->name = 'field_bundle_settings_node__fvideop';
+ $strongarm->value = array(
+ 'view_modes' => array(),
+ 'extra_fields' => array(
+ 'form' => array(
+ 'metatags' => array(
+ 'weight' => '17',
+ ),
+ 'path' => array(
+ 'weight' => '15',
+ ),
+ 'redirect' => array(
+ 'weight' => '14',
+ ),
+ 'xmlsitemap' => array(
+ 'weight' => '16',
+ ),
+ 'language' => array(
+ 'weight' => '13',
+ ),
+ ),
+ 'display' => array(),
+ ),
+ );
+ $export['field_bundle_settings_node__fvideop'] = $strongarm;
+
+ $strongarm = new stdClass();
+ $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
+ $strongarm->api_version = 1;
+ $strongarm->name = 'language_content_type_fvideop';
+ $strongarm->value = '4';
+ $export['language_content_type_fvideop'] = $strongarm;
+
+ $strongarm = new stdClass();
+ $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
+ $strongarm->api_version = 1;
+ $strongarm->name = 'menu_options_fvideop';
+ $strongarm->value = array(
+ 0 => 'main-menu',
+ );
+ $export['menu_options_fvideop'] = $strongarm;
+
+ $strongarm = new stdClass();
+ $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
+ $strongarm->api_version = 1;
+ $strongarm->name = 'menu_parent_fvideop';
+ $strongarm->value = 'main-menu:0';
+ $export['menu_parent_fvideop'] = $strongarm;
+
+ $strongarm = new stdClass();
+ $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
+ $strongarm->api_version = 1;
+ $strongarm->name = 'node_options_fvideop';
+ $strongarm->value = array(
+ 0 => 'revision',
+ );
+ $export['node_options_fvideop'] = $strongarm;
+
+ $strongarm = new stdClass();
+ $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
+ $strongarm->api_version = 1;
+ $strongarm->name = 'node_preview_fvideop';
+ $strongarm->value = '0';
+ $export['node_preview_fvideop'] = $strongarm;
+
+ $strongarm = new stdClass();
+ $strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
+ $strongarm->api_version = 1;
+ $strongarm->name = 'node_submitted_fvideop';
+ $strongarm->value = 1;
+ $export['node_submitted_fvideop'] = $strongarm;
+
+ return $export;
+}
From 8326dcb28d82dec2ac5f9e6c5cc6b22e62bcc14b Mon Sep 17 00:00:00 2001
From: lsantos-oq <luis.santos@openquest.pt>
Date: Wed, 9 Mar 2016 20:26:25 +0000
Subject: [PATCH 03/11] AFOUND-607 Create routine to change the fields by hook
---
.../foundation_videop.features.field_base.inc | 114 ++++++++++
.../foundation_videop.features.field_instance.inc | 137 +++++++++++
.../foundation_videop/foundation_videop.info | 14 +-
.../foundation_videop/foundation_videop.module | 250 +++++++++++++++++++++
4 files changed, 512 insertions(+), 3 deletions(-)
diff --git a/modules/features/foundation_videop/foundation_videop.features.field_base.inc b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
index 660e791..b796cb3 100644
--- a/modules/features/foundation_videop/foundation_videop.features.field_base.inc
+++ b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
@@ -10,6 +10,44 @@
function foundation_videop_field_default_field_bases() {
$field_bases = array();
+ // Exported field_base: 'field_fvdeiop_genre'.
+ $field_bases['field_fvdeiop_genre'] = array(
+ 'active' => 1,
+ 'cardinality' => 1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvdeiop_genre',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'target_id' => array(
+ 0 => 'target_id',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'entityreference',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ 'handler' => 'base',
+ 'handler_settings' => array(
+ 'autocomplete_items_limit' => 10,
+ 'behaviors' => array(
+ 'views-select-list' => array(
+ 'status' => 0,
+ ),
+ ),
+ 'sort' => array(
+ 'type' => 'none',
+ ),
+ 'target_bundles' => array(),
+ ),
+ 'target_type' => 'taxonomy_term',
+ ),
+ 'translatable' => 1,
+ 'type' => 'entityreference',
+ );
+
// Exported field_base: 'field_fvideop_background'.
$field_bases['field_fvideop_background'] = array(
'active' => 1,
@@ -106,6 +144,82 @@ function foundation_videop_field_default_field_bases() {
'type' => 'atom_reference',
);
+ // Exported field_base: 'field_fvideop_m_recommendations'.
+ $field_bases['field_fvideop_m_recommendations'] = array(
+ 'active' => 1,
+ 'cardinality' => 1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvideop_m_recommendations',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'target_id' => array(
+ 0 => 'target_id',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'entityreference',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ 'handler' => 'base',
+ 'handler_settings' => array(
+ 'autocomplete_items_limit' => 10,
+ 'behaviors' => array(
+ 'views-select-list' => array(
+ 'status' => 0,
+ ),
+ ),
+ 'sort' => array(
+ 'type' => 'none',
+ ),
+ 'target_bundles' => array(),
+ ),
+ 'target_type' => 'node',
+ ),
+ 'translatable' => 1,
+ 'type' => 'entityreference',
+ );
+
+ // Exported field_base: 'field_fvideop_partner'.
+ $field_bases['field_fvideop_partner'] = array(
+ 'active' => 1,
+ 'cardinality' => 1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvideop_partner',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'target_id' => array(
+ 0 => 'target_id',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'entityreference',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ 'handler' => 'base',
+ 'handler_settings' => array(
+ 'autocomplete_items_limit' => 10,
+ 'behaviors' => array(
+ 'views-select-list' => array(
+ 'status' => 0,
+ ),
+ ),
+ 'sort' => array(
+ 'type' => 'none',
+ ),
+ 'target_bundles' => array(),
+ ),
+ 'target_type' => 'node',
+ ),
+ 'translatable' => 1,
+ 'type' => 'entityreference',
+ );
+
// Exported field_base: 'field_fvideop_section_content'.
$field_bases['field_fvideop_section_content'] = array(
'active' => 1,
diff --git a/modules/features/foundation_videop/foundation_videop.features.field_instance.inc b/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
index 87a1a6f..8e84f6d 100644
--- a/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
+++ b/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
@@ -60,6 +60,55 @@ function foundation_videop_field_default_field_instances() {
),
);
+ // Exported field_instance: 'node-fvideop-field_fvdeiop_genre'.
+ $field_instances['node-fvideop-field_fvdeiop_genre'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'entityreference',
+ 'settings' => array(
+ 'link' => FALSE,
+ ),
+ 'type' => 'entityreference_label',
+ 'weight' => 14,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvdeiop_genre',
+ 'label' => 'Genre',
+ 'required' => 0,
+ 'settings' => array(
+ 'behaviors' => array(
+ 'taxonomy-index' => array(
+ 'status' => TRUE,
+ ),
+ ),
+ 'entity_translation_sync' => FALSE,
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'entityreference',
+ 'settings' => array(
+ 'match_operator' => 'CONTAINS',
+ 'path' => '',
+ 'size' => 60,
+ ),
+ 'type' => 'entityreference_autocomplete_tags',
+ 'weight' => 19,
+ ),
+ );
+
// Exported field_instance: 'node-fvideop-field_fvideop_background'.
$field_instances['node-fvideop-field_fvideop_background'] = array(
'bundle' => 'fvideop',
@@ -255,6 +304,94 @@ function foundation_videop_field_default_field_instances() {
),
);
+ // Exported field_instance: 'node-fvideop-field_fvideop_m_recommendations'.
+ $field_instances['node-fvideop-field_fvideop_m_recommendations'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'entityreference',
+ 'settings' => array(
+ 'link' => FALSE,
+ ),
+ 'type' => 'entityreference_label',
+ 'weight' => 15,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvideop_m_recommendations',
+ 'label' => 'Manual recommendations',
+ 'required' => 0,
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'entityreference',
+ 'settings' => array(
+ 'match_operator' => 'CONTAINS',
+ 'path' => '',
+ 'size' => 60,
+ ),
+ 'type' => 'entityreference_autocomplete',
+ 'weight' => 20,
+ ),
+ );
+
+ // Exported field_instance: 'node-fvideop-field_fvideop_partner'.
+ $field_instances['node-fvideop-field_fvideop_partner'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'entityreference',
+ 'settings' => array(
+ 'link' => FALSE,
+ ),
+ 'type' => 'entityreference_label',
+ 'weight' => 13,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvideop_partner',
+ 'label' => 'Partner',
+ 'required' => 0,
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'entityreference',
+ 'settings' => array(
+ 'match_operator' => 'CONTAINS',
+ 'path' => '',
+ 'size' => 60,
+ ),
+ 'type' => 'entityreference_autocomplete',
+ 'weight' => 18,
+ ),
+ );
+
// Exported field_instance: 'node-fvideop-field_fvideop_section_content'.
$field_instances['node-fvideop-field_fvideop_section_content'] = array(
'bundle' => 'fvideop',
diff --git a/modules/features/foundation_videop/foundation_videop.info b/modules/features/foundation_videop/foundation_videop.info
index 92767a3..e016ea0 100644
--- a/modules/features/foundation_videop/foundation_videop.info
+++ b/modules/features/foundation_videop/foundation_videop.info
@@ -1,38 +1,46 @@
name = Foundation Video Page
core = 7.x
-package = Features
+description = Video Page content type
version = 7.x-1.0
+package = ARTE Foundation
dependencies[] = atom_reference
dependencies[] = ctools
+dependencies[] = entityreference
dependencies[] = features
+dependencies[] = i18n_taxonomy
dependencies[] = node
dependencies[] = strongarm
+dependencies[] = taxonomy
dependencies[] = text
features[ctools][] = strongarm:strongarm:1
features[features_api][] = api:2
+features[field_base][] = field_fvdeiop_genre
features[field_base][] = field_fvideop_background
features[field_base][] = field_fvideop_bonus_videos
features[field_base][] = field_fvideop_desc_hl
features[field_base][] = field_fvideop_gallery
+features[field_base][] = field_fvideop_m_recommendations
+features[field_base][] = field_fvideop_partner
features[field_base][] = field_fvideop_section_content
features[field_base][] = field_fvideop_section_title
features[field_base][] = field_fvideop_social_headline
features[field_base][] = field_fvideop_subtitle
features[field_base][] = field_fvideop_video
features[field_base][] = field_fvideop_video_teaser
-features[field_base][] = field_xiti_chapters
features[field_instance][] = node-fvideop-body
+features[field_instance][] = node-fvideop-field_fvdeiop_genre
features[field_instance][] = node-fvideop-field_fvideop_background
features[field_instance][] = node-fvideop-field_fvideop_bonus_videos
features[field_instance][] = node-fvideop-field_fvideop_desc_hl
features[field_instance][] = node-fvideop-field_fvideop_gallery
+features[field_instance][] = node-fvideop-field_fvideop_m_recommendations
+features[field_instance][] = node-fvideop-field_fvideop_partner
features[field_instance][] = node-fvideop-field_fvideop_section_content
features[field_instance][] = node-fvideop-field_fvideop_section_title
features[field_instance][] = node-fvideop-field_fvideop_social_headline
features[field_instance][] = node-fvideop-field_fvideop_subtitle
features[field_instance][] = node-fvideop-field_fvideop_video
features[field_instance][] = node-fvideop-field_fvideop_video_teaser
-features[field_instance][] = node-fvideop-field_xiti_chapters
features[field_instance][] = node-fvideop-title_field
features[node][] = fvideop
features[variable][] = field_bundle_settings_node__fvideop
diff --git a/modules/features/foundation_videop/foundation_videop.module b/modules/features/foundation_videop/foundation_videop.module
index 14c5607..2821c80 100644
--- a/modules/features/foundation_videop/foundation_videop.module
+++ b/modules/features/foundation_videop/foundation_videop.module
@@ -5,3 +5,253 @@
*/
include_once 'foundation_videop.features.inc';
+
+/**
+ * Implements hook_menu().
+ */
+function foundation_videop_menu() {
+ // Replace the entityreference autocomplete
+
+ $items = array();
+
+ $items['fvideop/autocomplete/single/%/%/%'] = array(
+ 'title' => 'Foundation Videop Entity Reference Autocomplete',
+ 'page callback' => 'foundation_videop_autocomplete_callback',
+ 'page arguments' => array(2, 3, 4, 5),
+ 'access callback' => 'foundation_videop_autocomplete_access_callback',
+ 'access arguments' => array(2, 3, 4, 5),
+ 'type' => MENU_CALLBACK,
+ );
+ $items['fvideop/autocomplete/tags/%/%/%'] = array(
+ 'title' => 'Foundation Videop Entity Reference Autocomplete',
+ 'page callback' => 'foundation_videop_autocomplete_callback',
+ 'page arguments' => array(2, 3, 4, 5),
+ 'access callback' => 'foundation_videop_autocomplete_access_callback',
+ 'access arguments' => array(2, 3, 4, 5),
+ 'type' => MENU_CALLBACK,
+ );
+
+ return $items;
+}
+
+/**
+ * Implements hook_videop_field_access().
+ */
+function foundation_videop_field_access($op, $field, $entity_type, $entity, $account) {
+ if ($entity_type != 'node') return;
+ if (isset($entity->type) && $entity->type != 'fvideop') return;
+
+ $config = module_invoke_all('foundation_videop_fields', $field['field_name']);
+ if ($config) {
+ if (isset($config['hide']) && $config['hide']) return FALSE;
+ }
+}
+
+/**
+ *
+ */
+function foundation_videop_field_widget_form_alter(&$element, &$form_state, $context) {
+ if ($context['instance']['entity_type'] != 'node' || $context['instance']['bundle'] != 'fvideop' || $form_state['build_info']['form_id'] == 'field_ui_field_edit_form') return;
+
+ $field_name = '';
+ if (isset($element['#field_name'])) {
+ $field_name = $element['#field_name'];
+ } else {
+ $key = element_children($element);
+ $field_name = $element[$key[0]]['#field_name'];
+ }
+
+ $config = module_invoke_all('foundation_videop_fields', $field_name);
+ if ($config) {
+ if (isset($config['title'])) {
+ foundation_videop_change_field($element, '#title', $config['title']);
+ }
+
+ if (isset($config['description'])) {
+ foundation_videop_change_field($element, '#description', $config['description']);
+ }
+
+ if (isset($config['required']) && $config['required']) {
+ foundation_videop_change_field($element, '#required', $config['required']);
+ }
+
+ if (isset($config['entity_reference']) && $config['entity_reference']) {
+ if ($key = current(element_children($element))) {
+ foundation_videop_change_entity_reference($element[$key], $context);
+ } else {
+ foundation_videop_change_entity_reference($element, $context);
+ }
+ }
+ }
+}
+
+/**
+ *
+ */
+function foundation_videop_change_field(&$field, $name, $value) {
+ if ($key = current(element_children($field))) {
+ $field[$key][$name] = $value;
+ if (isset($field[$key]['value'])) $field[$key]['value'][$name] = $value;
+ } else {
+ $field[$name] = $value;
+ if (isset($field['value'])) $field['value'][$name] = $value;
+ }
+}
+
+/**
+ *
+ */
+function foundation_videop_change_entity_reference(&$field, $context) {
+ $instance = $context['instance'];
+ $entity = $context['form']['#entity'];
+ $entity_type = $instance['entity_type'];
+
+ if ($instance['widget']['type'] == 'entityreference_autocomplete' || $instance['widget']['type'] == 'entityreference_autocomplete_tags') {
+ $autocomplete_path = $instance['widget']['type'] == 'entityreference_autocomplete' ? 'fvideop/autocomplete/single' : 'fvideop/autocomplete/tags';
+
+ $autocomplete_path .= '/' . $field['#field_name'] . '/' . $instance['entity_type'] . '/' . $instance['bundle'] . '/';
+ // Use <NULL> as a placeholder in the URL when we don't have an entity.
+ // Most webservers collapse two consecutive slashes.
+ $id = 'NULL';
+ if ($entity) {
+ list($eid) = entity_extract_ids($entity_type, $entity);
+ if ($eid) {
+ $id = $eid;
+ }
+ }
+ $autocomplete_path .= $id;
+
+ $field['#autocomplete_path'] = $autocomplete_path;
+ $field['#element_validate'][] = '_foundation_videop_autocomplete_validate';
+ }
+}
+
+/**
+ * Gets the referenced video atom of the given video page node.
+ *
+ * @param Object $node the node object.
+ * @return Object the video atom object or NULL if the video page doens't
+ * reference a video atom.
+ */
+function foundation_videop_get_video($node) {
+ if ($node->type != 'fvideop') return NULL;
+
+ $videop = entity_metadata_wrapper('node', $node);
+ $video = $videop->field_fvideop_video->value();
+
+ if (empty($video)) return NULL;
+
+ return $video;
+}
+
+/**
+ * Menu callback: autocomplete the label of an entity.
+ *
+ * @param $type
+ * The widget type (i.e. 'single' or 'tags').
+ * @param $field_name
+ * The name of the entity-reference field.
+ * @param $entity_type
+ * The entity type.
+ * @param $bundle_name
+ * The bundle name.
+ * @param $entity_id
+ * Optional; The entity ID the entity-reference field is attached to.
+ * Defaults to ''.
+ * @param $string
+ * The label of the entity to query by.
+ */
+function foundation_videop_autocomplete_callback($type, $field_name, $entity_type, $bundle_name, $entity_id = '', $string = '') {
+ // If the request has a '/' in the search text, then the menu system will have
+ // split it into multiple arguments and $string will only be a partial. We want
+ // to make sure we recover the intended $string.
+ $args = func_get_args();
+ // Shift off the $type, $field_name, $entity_type, $bundle_name, and $entity_id args.
+ array_shift($args);
+ array_shift($args);
+ array_shift($args);
+ array_shift($args);
+ array_shift($args);
+ $string = implode('/', $args);
+
+ $field = field_info_field($field_name);
+ $instance = field_info_instance($entity_type, $field_name, $bundle_name);
+ $config = module_invoke_all('foundation_videop_fields', $field_name);
+ if (isset($config['settings'])) {
+ foundation_videop_field_settings($field['settings'], $config['settings']);
+ }
+
+ return entityreference_autocomplete_callback_get_matches($type, $field, $instance, $entity_type, $entity_id, $string);
+}
+
+/**
+ * Menu Access callback for the autocomplete widget.
+ *
+ * @param $type
+ * The widget type (i.e. 'single' or 'tags').
+ * @param $field_name
+ * The name of the entity-reference field.
+ * @param $entity_type
+ * The entity type.
+ * @param $bundle_name
+ * The bundle name.
+ * @return
+ * True if user can access this menu item.
+ */
+function foundation_videop_autocomplete_access_callback($type, $field_name, $entity_type, $bundle_name) {
+ $field = field_info_field($field_name);
+ $instance = field_info_instance($entity_type, $field_name, $bundle_name);
+ $config = module_invoke_all('foundation_videop_fields', $field_name);
+ if (isset($config['settings'])) {
+ foundation_videop_field_settings($field['settings'], $config['settings']);
+ }
+
+ if (!$field || !$instance || $field['type'] != 'entityreference' || !field_access('edit', $field, $entity_type)) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ *
+ */
+function foundation_videop_field_settings(&$settings, $new_settings) {
+ foreach ($new_settings as $key => $value) {
+ if (!isset($settings[$key])) continue;
+
+ if (is_array($value) && $key != 'target_bundles') {
+ foundation_videop_field_settings($settings[$key], $new_settings[$key]);
+ } else {
+ $settings[$key] = $value;
+ }
+ }
+}
+
+/**
+ *
+ */
+function _foundation_videop_autocomplete_validate($element, &$form_state, $form) {
+ if (!empty($element['#value'])) {
+ $field_name = $element['#field_name'];
+ $field = field_info_field($field_name);
+ $config = module_invoke_all('foundation_videop_fields', $field_name);
+ if (isset($config['settings'])) {
+ foundation_videop_field_settings($field['settings'], $config['settings']);
+ }
+ $instance = field_info_instance('node', $field_name, 'fvideop');
+ $langcode = $element['#language'];
+ $errors = array();
+
+ entityreference_field_validate('node', $form_state['node'], $field, $instance, $langcode, $form_state['values'][$field_name][$langcode], $errors);
+
+ if ($errors) {
+ $txt_errors = array();
+ $name = $field_name .']['. $langcode;
+ if ($instance['widget']['type'] == 'entityreference_autocomplete') $name .= ']['. $element['#delta'];
+
+ foreach ($errors[$field_name][$langcode][$element['#delta']] as $message) {
+ form_set_error($name, $message['message']);
+ }
+ }
+ }
+}
From fa04aea2c531ea77b09f497a31829e0bb6ae2387 Mon Sep 17 00:00:00 2001
From: lsantos-oq <luis.santos@openquest.pt>
Date: Thu, 10 Mar 2016 18:36:49 +0000
Subject: [PATCH 04/11] AFOUND-607 Add more fields. Correct and implement
routine fields
---
.../foundation_videop.features.field_base.inc | 138 +++++++++---
.../foundation_videop.features.field_instance.inc | 234 +++++++++++++--------
.../foundation_videop/foundation_videop.info | 12 +-
.../foundation_videop/foundation_videop.module | 102 ++++++---
4 files changed, 336 insertions(+), 150 deletions(-)
diff --git a/modules/features/foundation_videop/foundation_videop.features.field_base.inc b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
index b796cb3..971bca1 100644
--- a/modules/features/foundation_videop/foundation_videop.features.field_base.inc
+++ b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
@@ -10,13 +10,61 @@
function foundation_videop_field_default_field_bases() {
$field_bases = array();
- // Exported field_base: 'field_fvdeiop_genre'.
- $field_bases['field_fvdeiop_genre'] = array(
+ // Exported field_base: 'field_fvideop_background'.
+ $field_bases['field_fvideop_background'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
- 'field_name' => 'field_fvdeiop_genre',
+ 'field_name' => 'field_fvideop_background',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'sid' => array(
+ 0 => 'sid',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ ),
+ 'translatable' => 1,
+ 'type' => 'atom_reference',
+ );
+
+ // Exported field_base: 'field_fvideop_bonus_videos'.
+ $field_bases['field_fvideop_bonus_videos'] = array(
+ 'active' => 1,
+ 'cardinality' => -1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvideop_bonus_videos',
+ 'field_permissions' => array(
+ 'type' => 0,
+ ),
+ 'indexes' => array(
+ 'sid' => array(
+ 0 => 'sid',
+ ),
+ ),
+ 'locked' => 0,
+ 'module' => 'atom_reference',
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ ),
+ 'translatable' => 1,
+ 'type' => 'atom_reference',
+ );
+
+ // Exported field_base: 'field_fvideop_country'.
+ $field_bases['field_fvideop_country'] = array(
+ 'active' => 1,
+ 'cardinality' => 1,
+ 'deleted' => 0,
+ 'entity_types' => array(),
+ 'field_name' => 'field_fvideop_country',
'field_permissions' => array(
'type' => 0,
),
@@ -48,100 +96,128 @@ function foundation_videop_field_default_field_bases() {
'type' => 'entityreference',
);
- // Exported field_base: 'field_fvideop_background'.
- $field_bases['field_fvideop_background'] = array(
+ // Exported field_base: 'field_fvideop_desc_hl'.
+ $field_bases['field_fvideop_desc_hl'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
- 'field_name' => 'field_fvideop_background',
+ 'field_name' => 'field_fvideop_desc_hl',
'field_permissions' => array(
'type' => 0,
),
'indexes' => array(
- 'sid' => array(
- 0 => 'sid',
+ 'format' => array(
+ 0 => 'format',
),
),
'locked' => 0,
- 'module' => 'atom_reference',
+ 'module' => 'text',
'settings' => array(
'entity_translation_sync' => FALSE,
),
'translatable' => 1,
- 'type' => 'atom_reference',
+ 'type' => 'text_long',
);
- // Exported field_base: 'field_fvideop_bonus_videos'.
- $field_bases['field_fvideop_bonus_videos'] = array(
+ // Exported field_base: 'field_fvideop_event'.
+ $field_bases['field_fvideop_event'] = array(
'active' => 1,
'cardinality' => -1,
'deleted' => 0,
'entity_types' => array(),
- 'field_name' => 'field_fvideop_bonus_videos',
+ 'field_name' => 'field_fvideop_event',
'field_permissions' => array(
'type' => 0,
),
'indexes' => array(
- 'sid' => array(
- 0 => 'sid',
+ 'target_id' => array(
+ 0 => 'target_id',
),
),
'locked' => 0,
- 'module' => 'atom_reference',
+ 'module' => 'entityreference',
'settings' => array(
'entity_translation_sync' => FALSE,
+ 'handler' => 'base',
+ 'handler_settings' => array(
+ 'autocomplete_items_limit' => 10,
+ 'behaviors' => array(
+ 'views-select-list' => array(
+ 'status' => 0,
+ ),
+ ),
+ 'sort' => array(
+ 'type' => 'none',
+ ),
+ 'target_bundles' => array(),
+ ),
+ 'target_type' => 'node',
),
'translatable' => 1,
- 'type' => 'atom_reference',
+ 'type' => 'entityreference',
);
- // Exported field_base: 'field_fvideop_desc_hl'.
- $field_bases['field_fvideop_desc_hl'] = array(
+ // Exported field_base: 'field_fvideop_gallery'.
+ $field_bases['field_fvideop_gallery'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
- 'field_name' => 'field_fvideop_desc_hl',
+ 'field_name' => 'field_fvideop_gallery',
'field_permissions' => array(
'type' => 0,
),
'indexes' => array(
- 'format' => array(
- 0 => 'format',
+ 'sid' => array(
+ 0 => 'sid',
),
),
'locked' => 0,
- 'module' => 'text',
+ 'module' => 'atom_reference',
'settings' => array(
'entity_translation_sync' => FALSE,
),
'translatable' => 1,
- 'type' => 'text_long',
+ 'type' => 'atom_reference',
);
- // Exported field_base: 'field_fvideop_gallery'.
- $field_bases['field_fvideop_gallery'] = array(
+ // Exported field_base: 'field_fvideop_genre'.
+ $field_bases['field_fvideop_genre'] = array(
'active' => 1,
'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
- 'field_name' => 'field_fvideop_gallery',
+ 'field_name' => 'field_fvideop_genre',
'field_permissions' => array(
'type' => 0,
),
'indexes' => array(
- 'sid' => array(
- 0 => 'sid',
+ 'target_id' => array(
+ 0 => 'target_id',
),
),
'locked' => 0,
- 'module' => 'atom_reference',
+ 'module' => 'entityreference',
'settings' => array(
'entity_translation_sync' => FALSE,
+ 'handler' => 'base',
+ 'handler_settings' => array(
+ 'autocomplete_items_limit' => 10,
+ 'behaviors' => array(
+ 'views-select-list' => array(
+ 'status' => 0,
+ ),
+ ),
+ 'sort' => array(
+ 'type' => 'none',
+ ),
+ 'target_bundles' => array(),
+ ),
+ 'target_type' => 'taxonomy_term',
),
'translatable' => 1,
- 'type' => 'atom_reference',
+ 'type' => 'entityreference',
);
// Exported field_base: 'field_fvideop_m_recommendations'.
diff --git a/modules/features/foundation_videop/foundation_videop.features.field_instance.inc b/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
index 8e84f6d..a3a50a5 100644
--- a/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
+++ b/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
@@ -60,8 +60,8 @@ function foundation_videop_field_default_field_instances() {
),
);
- // Exported field_instance: 'node-fvideop-field_fvdeiop_genre'.
- $field_instances['node-fvideop-field_fvdeiop_genre'] = array(
+ // Exported field_instance: 'node-fvideop-field_fvideop_background'.
+ $field_instances['node-fvideop-field_fvideop_background'] = array(
'bundle' => 'fvideop',
'default_value' => NULL,
'deleted' => 0,
@@ -69,12 +69,13 @@ function foundation_videop_field_default_field_instances() {
'display' => array(
'default' => array(
'label' => 'above',
- 'module' => 'entityreference',
+ 'module' => 'atom_reference',
'settings' => array(
- 'link' => FALSE,
+ 'link' => 0,
+ 'override' => 0,
),
- 'type' => 'entityreference_label',
- 'weight' => 14,
+ 'type' => 'title',
+ 'weight' => 4,
),
'teaser' => array(
'label' => 'above',
@@ -84,33 +85,33 @@ function foundation_videop_field_default_field_instances() {
),
),
'entity_type' => 'node',
- 'field_name' => 'field_fvdeiop_genre',
- 'label' => 'Genre',
+ 'field_name' => 'field_fvideop_background',
+ 'label' => 'Background',
'required' => 0,
'settings' => array(
- 'behaviors' => array(
- 'taxonomy-index' => array(
- 'status' => TRUE,
- ),
- ),
+ 'allow_override' => 0,
'entity_translation_sync' => FALSE,
+ 'referencable_types' => array(
+ 'gallery' => 0,
+ 'iframe' => 0,
+ 'image' => 'image',
+ 'video' => 0,
+ ),
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
- 'module' => 'entityreference',
+ 'module' => 'atom_reference',
'settings' => array(
- 'match_operator' => 'CONTAINS',
- 'path' => '',
- 'size' => 60,
+ 'context' => 'sdl_editor_representation',
),
- 'type' => 'entityreference_autocomplete_tags',
- 'weight' => 19,
+ 'type' => 'atom_reference_textfield',
+ 'weight' => 8,
),
);
- // Exported field_instance: 'node-fvideop-field_fvideop_background'.
- $field_instances['node-fvideop-field_fvideop_background'] = array(
+ // Exported field_instance: 'node-fvideop-field_fvideop_bonus_videos'.
+ $field_instances['node-fvideop-field_fvideop_bonus_videos'] = array(
'bundle' => 'fvideop',
'default_value' => NULL,
'deleted' => 0,
@@ -124,7 +125,7 @@ function foundation_videop_field_default_field_instances() {
'override' => 0,
),
'type' => 'title',
- 'weight' => 4,
+ 'weight' => 6,
),
'teaser' => array(
'label' => 'above',
@@ -134,8 +135,8 @@ function foundation_videop_field_default_field_instances() {
),
),
'entity_type' => 'node',
- 'field_name' => 'field_fvideop_background',
- 'label' => 'Background',
+ 'field_name' => 'field_fvideop_bonus_videos',
+ 'label' => 'Bonus videos',
'required' => 0,
'settings' => array(
'allow_override' => 0,
@@ -143,8 +144,8 @@ function foundation_videop_field_default_field_instances() {
'referencable_types' => array(
'gallery' => 0,
'iframe' => 0,
- 'image' => 'image',
- 'video' => 0,
+ 'image' => 0,
+ 'video' => 'video',
),
'user_register_form' => FALSE,
),
@@ -155,12 +156,12 @@ function foundation_videop_field_default_field_instances() {
'context' => 'sdl_editor_representation',
),
'type' => 'atom_reference_textfield',
- 'weight' => 8,
+ 'weight' => 7,
),
);
- // Exported field_instance: 'node-fvideop-field_fvideop_bonus_videos'.
- $field_instances['node-fvideop-field_fvideop_bonus_videos'] = array(
+ // Exported field_instance: 'node-fvideop-field_fvideop_country'.
+ $field_instances['node-fvideop-field_fvideop_country'] = array(
'bundle' => 'fvideop',
'default_value' => NULL,
'deleted' => 0,
@@ -168,13 +169,12 @@ function foundation_videop_field_default_field_instances() {
'display' => array(
'default' => array(
'label' => 'above',
- 'module' => 'atom_reference',
+ 'module' => 'entityreference',
'settings' => array(
- 'link' => 0,
- 'override' => 0,
+ 'link' => FALSE,
),
- 'type' => 'title',
- 'weight' => 6,
+ 'type' => 'entityreference_label',
+ 'weight' => 17,
),
'teaser' => array(
'label' => 'above',
@@ -184,28 +184,28 @@ function foundation_videop_field_default_field_instances() {
),
),
'entity_type' => 'node',
- 'field_name' => 'field_fvideop_bonus_videos',
- 'label' => 'Bonus videos',
+ 'field_name' => 'field_fvideop_country',
+ 'label' => 'Country',
'required' => 0,
'settings' => array(
- 'allow_override' => 0,
- 'entity_translation_sync' => FALSE,
- 'referencable_types' => array(
- 'gallery' => 0,
- 'iframe' => 0,
- 'image' => 0,
- 'video' => 'video',
+ 'behaviors' => array(
+ 'taxonomy-index' => array(
+ 'status' => TRUE,
+ ),
),
+ 'entity_translation_sync' => FALSE,
'user_register_form' => FALSE,
),
'widget' => array(
'active' => 1,
- 'module' => 'atom_reference',
+ 'module' => 'entityreference',
'settings' => array(
- 'context' => 'sdl_editor_representation',
+ 'match_operator' => 'CONTAINS',
+ 'path' => '',
+ 'size' => 60,
),
- 'type' => 'atom_reference_textfield',
- 'weight' => 7,
+ 'type' => 'entityreference_autocomplete',
+ 'weight' => 22,
),
);
@@ -254,6 +254,50 @@ function foundation_videop_field_default_field_instances() {
),
);
+ // Exported field_instance: 'node-fvideop-field_fvideop_event'.
+ $field_instances['node-fvideop-field_fvideop_event'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'entityreference',
+ 'settings' => array(
+ 'link' => FALSE,
+ ),
+ 'type' => 'entityreference_label',
+ 'weight' => 16,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvideop_event',
+ 'label' => 'Event',
+ 'required' => 0,
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'entityreference',
+ 'settings' => array(
+ 'match_operator' => 'CONTAINS',
+ 'path' => '',
+ 'size' => 60,
+ ),
+ 'type' => 'entityreference_autocomplete',
+ 'weight' => 21,
+ ),
+ );
+
// Exported field_instance: 'node-fvideop-field_fvideop_gallery'.
$field_instances['node-fvideop-field_fvideop_gallery'] = array(
'bundle' => 'fvideop',
@@ -304,6 +348,55 @@ function foundation_videop_field_default_field_instances() {
),
);
+ // Exported field_instance: 'node-fvideop-field_fvideop_genre'.
+ $field_instances['node-fvideop-field_fvideop_genre'] = array(
+ 'bundle' => 'fvideop',
+ 'default_value' => NULL,
+ 'deleted' => 0,
+ 'description' => '',
+ 'display' => array(
+ 'default' => array(
+ 'label' => 'above',
+ 'module' => 'entityreference',
+ 'settings' => array(
+ 'link' => FALSE,
+ ),
+ 'type' => 'entityreference_label',
+ 'weight' => 14,
+ ),
+ 'teaser' => array(
+ 'label' => 'above',
+ 'settings' => array(),
+ 'type' => 'hidden',
+ 'weight' => 0,
+ ),
+ ),
+ 'entity_type' => 'node',
+ 'field_name' => 'field_fvideop_genre',
+ 'label' => 'Genre',
+ 'required' => 0,
+ 'settings' => array(
+ 'behaviors' => array(
+ 'taxonomy-index' => array(
+ 'status' => TRUE,
+ ),
+ ),
+ 'entity_translation_sync' => FALSE,
+ 'user_register_form' => FALSE,
+ ),
+ 'widget' => array(
+ 'active' => 1,
+ 'module' => 'entityreference',
+ 'settings' => array(
+ 'match_operator' => 'CONTAINS',
+ 'path' => '',
+ 'size' => 60,
+ ),
+ 'type' => 'entityreference_autocomplete_tags',
+ 'weight' => 19,
+ ),
+ );
+
// Exported field_instance: 'node-fvideop-field_fvideop_m_recommendations'.
$field_instances['node-fvideop-field_fvideop_m_recommendations'] = array(
'bundle' => 'fvideop',
@@ -672,46 +765,6 @@ function foundation_videop_field_default_field_instances() {
),
);
- // Exported field_instance: 'node-fvideop-field_xiti_chapters'.
- $field_instances['node-fvideop-field_xiti_chapters'] = array(
- 'bundle' => 'fvideop',
- 'default_value' => NULL,
- 'deleted' => 0,
- 'description' => 'Enter Xiti chapters one by one, separated by a comma. Please, do not enter all chapters at once.<br/>Format : parent, child, second-child',
- 'display' => array(
- 'default' => array(
- 'label' => 'above',
- 'module' => 'i18n_taxonomy',
- 'settings' => array(),
- 'type' => 'i18n_taxonomy_term_reference_link',
- 'weight' => 0,
- ),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
- ),
- 'entity_type' => 'node',
- 'field_name' => 'field_xiti_chapters',
- 'label' => 'Xiti chapters',
- 'required' => FALSE,
- 'settings' => array(
- 'entity_translation_sync' => FALSE,
- 'user_register_form' => FALSE,
- ),
- 'widget' => array(
- 'module' => 'taxonomy',
- 'settings' => array(
- 'autocomplete_path' => 'taxonomy/autocomplete',
- 'size' => 60,
- ),
- 'type' => 'taxonomy_autocomplete',
- 'weight' => 12,
- ),
- );
-
// Exported field_instance: 'node-fvideop-title_field'.
$field_instances['node-fvideop-title_field'] = array(
'bundle' => 'fvideop',
@@ -762,10 +815,14 @@ function foundation_videop_field_default_field_instances() {
// Included for use with string extractors like potx.
t('Background');
t('Bonus videos');
+ t('Country');
t('Description / Headline');
t('Editorial Text');
- t('Enter Xiti chapters one by one, separated by a comma. Please, do not enter all chapters at once.<br/>Format : parent, child, second-child');
+ t('Event');
t('Gallery');
+ t('Genre');
+ t('Manual recommendations');
+ t('Partner');
t('Section content');
t('Section title');
t('Social Headline');
@@ -773,7 +830,6 @@ function foundation_videop_field_default_field_instances() {
t('Titre');
t('Video');
t('Video teaser');
- t('Xiti chapters');
return $field_instances;
}
diff --git a/modules/features/foundation_videop/foundation_videop.info b/modules/features/foundation_videop/foundation_videop.info
index e016ea0..7c628dd 100644
--- a/modules/features/foundation_videop/foundation_videop.info
+++ b/modules/features/foundation_videop/foundation_videop.info
@@ -1,8 +1,8 @@
name = Foundation Video Page
-core = 7.x
description = Video Page content type
-version = 7.x-1.0
+core = 7.x
package = ARTE Foundation
+version = 7.x-1.0
dependencies[] = atom_reference
dependencies[] = ctools
dependencies[] = entityreference
@@ -14,11 +14,13 @@ dependencies[] = taxonomy
dependencies[] = text
features[ctools][] = strongarm:strongarm:1
features[features_api][] = api:2
-features[field_base][] = field_fvdeiop_genre
features[field_base][] = field_fvideop_background
features[field_base][] = field_fvideop_bonus_videos
+features[field_base][] = field_fvideop_country
features[field_base][] = field_fvideop_desc_hl
+features[field_base][] = field_fvideop_event
features[field_base][] = field_fvideop_gallery
+features[field_base][] = field_fvideop_genre
features[field_base][] = field_fvideop_m_recommendations
features[field_base][] = field_fvideop_partner
features[field_base][] = field_fvideop_section_content
@@ -28,11 +30,13 @@ features[field_base][] = field_fvideop_subtitle
features[field_base][] = field_fvideop_video
features[field_base][] = field_fvideop_video_teaser
features[field_instance][] = node-fvideop-body
-features[field_instance][] = node-fvideop-field_fvdeiop_genre
features[field_instance][] = node-fvideop-field_fvideop_background
features[field_instance][] = node-fvideop-field_fvideop_bonus_videos
+features[field_instance][] = node-fvideop-field_fvideop_country
features[field_instance][] = node-fvideop-field_fvideop_desc_hl
+features[field_instance][] = node-fvideop-field_fvideop_event
features[field_instance][] = node-fvideop-field_fvideop_gallery
+features[field_instance][] = node-fvideop-field_fvideop_genre
features[field_instance][] = node-fvideop-field_fvideop_m_recommendations
features[field_instance][] = node-fvideop-field_fvideop_partner
features[field_instance][] = node-fvideop-field_fvideop_section_content
diff --git a/modules/features/foundation_videop/foundation_videop.module b/modules/features/foundation_videop/foundation_videop.module
index 2821c80..cb72418 100644
--- a/modules/features/foundation_videop/foundation_videop.module
+++ b/modules/features/foundation_videop/foundation_videop.module
@@ -48,7 +48,7 @@ function foundation_videop_field_access($op, $field, $entity_type, $entity, $acc
}
/**
- *
+ * Implements hook_field_widget_form_alter():
*/
function foundation_videop_field_widget_form_alter(&$element, &$form_state, $context) {
if ($context['instance']['entity_type'] != 'node' || $context['instance']['bundle'] != 'fvideop' || $form_state['build_info']['form_id'] == 'field_ui_field_edit_form') return;
@@ -86,7 +86,46 @@ function foundation_videop_field_widget_form_alter(&$element, &$form_state, $con
}
/**
- *
+ * Implements hook_form_ID_alter().for fvideop_node
+ */
+function foundation_videop_form_fvideop_node_form_alter(&$form, &$form_state, $form_id) {
+ $fields = field_info_instances('node', 'fvideop');
+ $langcode = $form['language']['#value'];
+
+ foreach ($fields as $field_name => $field) {
+ if (isset($form[$field_name])) {
+ $config = module_invoke_all('foundation_videop_fields', $field_name);
+
+ if ($config) {
+ if (isset($config['multiple']) && !$config['multiple']) {
+ if (isset($form[$field_name][$langcode]['#cardinality'])) {
+ $form[$field_name][$langcode]['#cardinality'] = 1;
+ }
+
+ if (isset($form[$field_name][$langcode]['add_more'])) {
+ unset($form[$field_name][$langcode]['add_more']);
+ }
+
+ if (isset($form[$field_name][$langcode][0])) {
+ unset($form[$field_name][$langcode][0]['_weight']);
+ switch ($field['widget']['module']) {
+ case 'entityreference':
+ $form[$field_name][$langcode][0]['target_id']['#title'] = $form[$field_name][$langcode]['#title'];
+ break;
+ }
+ }
+
+ if (isset($form[$field_name][$langcode][1])) {
+ unset($form[$field_name][$langcode][1]);
+ }
+ }
+ }
+ }
+ }
+}
+
+/**
+ * Replace the values of field
*/
function foundation_videop_change_field(&$field, $name, $value) {
if ($key = current(element_children($field))) {
@@ -176,10 +215,9 @@ function foundation_videop_autocomplete_callback($type, $field_name, $entity_typ
$field = field_info_field($field_name);
$instance = field_info_instance($entity_type, $field_name, $bundle_name);
+ // HACK
$config = module_invoke_all('foundation_videop_fields', $field_name);
- if (isset($config['settings'])) {
- foundation_videop_field_settings($field['settings'], $config['settings']);
- }
+ if (isset($config['settings'])) $field['settings'] = $config['settings'];
return entityreference_autocomplete_callback_get_matches($type, $field, $instance, $entity_type, $entity_id, $string);
}
@@ -202,9 +240,7 @@ function foundation_videop_autocomplete_access_callback($type, $field_name, $ent
$field = field_info_field($field_name);
$instance = field_info_instance($entity_type, $field_name, $bundle_name);
$config = module_invoke_all('foundation_videop_fields', $field_name);
- if (isset($config['settings'])) {
- foundation_videop_field_settings($field['settings'], $config['settings']);
- }
+ if (isset($config['settings'])) $field['settings'] = $config['settings'];
if (!$field || !$instance || $field['type'] != 'entityreference' || !field_access('edit', $field, $entity_type)) {
return FALSE;
@@ -215,29 +251,12 @@ function foundation_videop_autocomplete_access_callback($type, $field_name, $ent
/**
*
*/
-function foundation_videop_field_settings(&$settings, $new_settings) {
- foreach ($new_settings as $key => $value) {
- if (!isset($settings[$key])) continue;
-
- if (is_array($value) && $key != 'target_bundles') {
- foundation_videop_field_settings($settings[$key], $new_settings[$key]);
- } else {
- $settings[$key] = $value;
- }
- }
-}
-
-/**
- *
- */
function _foundation_videop_autocomplete_validate($element, &$form_state, $form) {
if (!empty($element['#value'])) {
$field_name = $element['#field_name'];
$field = field_info_field($field_name);
$config = module_invoke_all('foundation_videop_fields', $field_name);
- if (isset($config['settings'])) {
- foundation_videop_field_settings($field['settings'], $config['settings']);
- }
+ if (isset($config['settings'])) $field['settings'] = $config['settings'];
$instance = field_info_instance('node', $field_name, 'fvideop');
$langcode = $element['#language'];
$errors = array();
@@ -255,3 +274,34 @@ function _foundation_videop_autocomplete_validate($element, &$form_state, $form)
}
}
}
+
+/**
+ * Implements hook_views_data_alter():
+ */
+function foundation_videop_views_data_alter(&$data) {
+ $fields = field_info_instances('node', 'fvideop');
+
+ foreach ($fields as $field_name => $field) {
+ $config = module_invoke_all('foundation_videop_fields', $field_name);
+
+ if ($config) {
+ if (isset($data['entity_node'][$field_name])) {
+ if (isset($config['hide']) && $config['hide']) {
+ unset($data['entity_node'][$field_name]);
+ }
+ }
+
+ if (isset($data['field_data_'. $field_name])) {
+ if (isset($config['hide']) && $config['hide']) {
+ unset($data['field_data_'. $field_name]);
+ }
+ }
+
+ if (isset($data['field_revision_'. $field_name])) {
+ if (isset($config['hide']) && $config['hide']) {
+ unset($data['field_revision_'. $field_name]);
+ }
+ }
+ }
+ }
+}
From 7430df4c1c3a5b169ec4230fb3944110baa2007c Mon Sep 17 00:00:00 2001
From: lsantos-oq <luis.santos@openquest.pt>
Date: Thu, 10 Mar 2016 18:54:16 +0000
Subject: [PATCH 05/11] AFOUND-607 Re-export features
---
.../foundation_videop.features.field_base.inc | 28 ----------------------
.../foundation_videop.features.field_instance.inc | 20 ++++++++--------
.../foundation_videop/foundation_videop.info | 5 ++++
.../foundation_videop.strongarm.inc | 10 ++++----
4 files changed, 20 insertions(+), 43 deletions(-)
diff --git a/modules/features/foundation_videop/foundation_videop.features.field_base.inc b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
index 971bca1..1cb3e04 100644
--- a/modules/features/foundation_videop/foundation_videop.features.field_base.inc
+++ b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
@@ -443,33 +443,5 @@ function foundation_videop_field_default_field_bases() {
'type' => 'atom_reference',
);
- // Exported field_base: 'field_xiti_chapters'.
- $field_bases['field_xiti_chapters'] = array(
- 'active' => 1,
- 'cardinality' => -1,
- 'deleted' => 0,
- 'entity_types' => array(),
- 'field_name' => 'field_xiti_chapters',
- 'indexes' => array(
- 'tid' => array(
- 0 => 'tid',
- ),
- ),
- 'locked' => 0,
- 'module' => 'taxonomy',
- 'settings' => array(
- 'allowed_values' => array(
- 0 => array(
- 'vocabulary' => 'xiti_chapters',
- 'parent' => 0,
- ),
- ),
- 'entity_translation_sync' => FALSE,
- 'options_list_callback' => 'i18n_taxonomy_allowed_values',
- ),
- 'translatable' => 0,
- 'type' => 'taxonomy_term_reference',
- );
-
return $field_bases;
}
diff --git a/modules/features/foundation_videop/foundation_videop.features.field_instance.inc b/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
index a3a50a5..bbcf627 100644
--- a/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
+++ b/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
@@ -106,7 +106,7 @@ function foundation_videop_field_default_field_instances() {
'context' => 'sdl_editor_representation',
),
'type' => 'atom_reference_textfield',
- 'weight' => 8,
+ 'weight' => 5,
),
);
@@ -156,7 +156,7 @@ function foundation_videop_field_default_field_instances() {
'context' => 'sdl_editor_representation',
),
'type' => 'atom_reference_textfield',
- 'weight' => 7,
+ 'weight' => 11,
),
);
@@ -205,7 +205,7 @@ function foundation_videop_field_default_field_instances() {
'size' => 60,
),
'type' => 'entityreference_autocomplete',
- 'weight' => 22,
+ 'weight' => 16,
),
);
@@ -250,7 +250,7 @@ function foundation_videop_field_default_field_instances() {
'rows' => 5,
),
'type' => 'text_textarea',
- 'weight' => 5,
+ 'weight' => 6,
),
);
@@ -294,7 +294,7 @@ function foundation_videop_field_default_field_instances() {
'size' => 60,
),
'type' => 'entityreference_autocomplete',
- 'weight' => 21,
+ 'weight' => 15,
),
);
@@ -344,7 +344,7 @@ function foundation_videop_field_default_field_instances() {
'context' => 'sdl_editor_representation',
),
'type' => 'atom_reference_textfield',
- 'weight' => 6,
+ 'weight' => 8,
),
);
@@ -393,7 +393,7 @@ function foundation_videop_field_default_field_instances() {
'size' => 60,
),
'type' => 'entityreference_autocomplete_tags',
- 'weight' => 19,
+ 'weight' => 13,
),
);
@@ -437,7 +437,7 @@ function foundation_videop_field_default_field_instances() {
'size' => 60,
),
'type' => 'entityreference_autocomplete',
- 'weight' => 20,
+ 'weight' => 14,
),
);
@@ -481,7 +481,7 @@ function foundation_videop_field_default_field_instances() {
'size' => 60,
),
'type' => 'entityreference_autocomplete',
- 'weight' => 18,
+ 'weight' => 12,
),
);
@@ -616,7 +616,7 @@ function foundation_videop_field_default_field_instances() {
'size' => 60,
),
'type' => 'text_textfield',
- 'weight' => 11,
+ 'weight' => 7,
),
);
diff --git a/modules/features/foundation_videop/foundation_videop.info b/modules/features/foundation_videop/foundation_videop.info
index 7c628dd..d925e69 100644
--- a/modules/features/foundation_videop/foundation_videop.info
+++ b/modules/features/foundation_videop/foundation_videop.info
@@ -54,3 +54,8 @@ features[variable][] = menu_parent_fvideop
features[variable][] = node_options_fvideop
features[variable][] = node_preview_fvideop
features[variable][] = node_submitted_fvideop
+features_exclude[dependencies][alw_fields] = alw_fields
+features_exclude[dependencies][alw_videop] = alw_videop
+features_exclude[field_base][field_xiti_chapters] = field_xiti_chapters
+features_exclude[field_instance][node-fvideop-field_xiti_chapters] = node-fvideop-field_xiti_chapters
+features_exclude[taxonomy][xiti_chapters] = xiti_chapters
diff --git a/modules/features/foundation_videop/foundation_videop.strongarm.inc b/modules/features/foundation_videop/foundation_videop.strongarm.inc
index 8c7b660..2e8c3a6 100644
--- a/modules/features/foundation_videop/foundation_videop.strongarm.inc
+++ b/modules/features/foundation_videop/foundation_videop.strongarm.inc
@@ -19,19 +19,19 @@ function foundation_videop_strongarm() {
'extra_fields' => array(
'form' => array(
'metatags' => array(
- 'weight' => '17',
+ 'weight' => '22',
),
'path' => array(
- 'weight' => '15',
+ 'weight' => '20',
),
'redirect' => array(
- 'weight' => '14',
+ 'weight' => '19',
),
'xmlsitemap' => array(
- 'weight' => '16',
+ 'weight' => '21',
),
'language' => array(
- 'weight' => '13',
+ 'weight' => '18',
),
),
'display' => array(),
From 8f738f05ddbfed15413c89918f01cb43206dcb69 Mon Sep 17 00:00:00 2001
From: lsantos-oq <luis.santos@openquest.pt>
Date: Thu, 17 Mar 2016 17:41:51 +0000
Subject: [PATCH 06/11] AFOUND-607 Correct the routine to disable multiple
value
---
.../foundation_videop.features.field_base.inc | 10 +-
.../foundation_videop.features.field_instance.inc | 105 ---------------------
.../foundation_videop/foundation_videop.info | 4 +-
.../foundation_videop/foundation_videop.module | 51 +++++-----
.../foundation_videop.strongarm.inc | 30 ++----
5 files changed, 41 insertions(+), 159 deletions(-)
diff --git a/modules/features/foundation_videop/foundation_videop.features.field_base.inc b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
index 1cb3e04..6bc8f3b 100644
--- a/modules/features/foundation_videop/foundation_videop.features.field_base.inc
+++ b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
@@ -92,7 +92,7 @@ function foundation_videop_field_default_field_bases() {
),
'target_type' => 'taxonomy_term',
),
- 'translatable' => 1,
+ 'translatable' => 0,
'type' => 'entityreference',
);
@@ -154,7 +154,7 @@ function foundation_videop_field_default_field_bases() {
),
'target_type' => 'node',
),
- 'translatable' => 1,
+ 'translatable' => 0,
'type' => 'entityreference',
);
@@ -216,7 +216,7 @@ function foundation_videop_field_default_field_bases() {
),
'target_type' => 'taxonomy_term',
),
- 'translatable' => 1,
+ 'translatable' => 0,
'type' => 'entityreference',
);
@@ -254,7 +254,7 @@ function foundation_videop_field_default_field_bases() {
),
'target_type' => 'node',
),
- 'translatable' => 1,
+ 'translatable' => 0,
'type' => 'entityreference',
);
@@ -292,7 +292,7 @@ function foundation_videop_field_default_field_bases() {
),
'target_type' => 'node',
),
- 'translatable' => 1,
+ 'translatable' => 0,
'type' => 'entityreference',
);
diff --git a/modules/features/foundation_videop/foundation_videop.features.field_instance.inc b/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
index bbcf627..d4a7792 100644
--- a/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
+++ b/modules/features/foundation_videop/foundation_videop.features.field_instance.inc
@@ -24,15 +24,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'text_default',
'weight' => 1,
),
- 'teaser' => array(
- 'label' => 'hidden',
- 'module' => 'text',
- 'settings' => array(
- 'trim_length' => 600,
- ),
- 'type' => 'text_summary_or_trimmed',
- 'weight' => 1,
- ),
),
'entity_type' => 'node',
'field_name' => 'body',
@@ -77,12 +68,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'title',
'weight' => 4,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_background',
@@ -127,12 +112,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'title',
'weight' => 6,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_bonus_videos',
@@ -176,12 +155,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'entityreference_label',
'weight' => 17,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_country',
@@ -223,12 +196,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'text_default',
'weight' => 8,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_desc_hl',
@@ -270,12 +237,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'entityreference_label',
'weight' => 16,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_event',
@@ -315,12 +276,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'title',
'weight' => 5,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_gallery',
@@ -364,12 +319,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'entityreference_label',
'weight' => 14,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_genre',
@@ -413,12 +362,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'entityreference_label',
'weight' => 15,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_m_recommendations',
@@ -457,12 +400,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'entityreference_label',
'weight' => 13,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_partner',
@@ -499,12 +436,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'text_default',
'weight' => 11,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_section_content',
@@ -544,12 +475,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'text_default',
'weight' => 10,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_section_title',
@@ -589,12 +514,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'text_default',
'weight' => 9,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_social_headline',
@@ -634,12 +553,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'text_default',
'weight' => 12,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_subtitle',
@@ -682,12 +595,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'title',
'weight' => 3,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_video',
@@ -732,12 +639,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'title',
'weight' => 7,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'field_fvideop_video_teaser',
@@ -778,12 +679,6 @@ function foundation_videop_field_default_field_instances() {
'type' => 'hidden',
'weight' => 2,
),
- 'teaser' => array(
- 'label' => 'above',
- 'settings' => array(),
- 'type' => 'hidden',
- 'weight' => 0,
- ),
),
'entity_type' => 'node',
'field_name' => 'title_field',
diff --git a/modules/features/foundation_videop/foundation_videop.info b/modules/features/foundation_videop/foundation_videop.info
index d925e69..35f6f20 100644
--- a/modules/features/foundation_videop/foundation_videop.info
+++ b/modules/features/foundation_videop/foundation_videop.info
@@ -47,15 +47,13 @@ features[field_instance][] = node-fvideop-field_fvideop_video
features[field_instance][] = node-fvideop-field_fvideop_video_teaser
features[field_instance][] = node-fvideop-title_field
features[node][] = fvideop
-features[variable][] = field_bundle_settings_node__fvideop
+features[variable][] = entity_translation_settings_node__fvideop
features[variable][] = language_content_type_fvideop
features[variable][] = menu_options_fvideop
features[variable][] = menu_parent_fvideop
features[variable][] = node_options_fvideop
features[variable][] = node_preview_fvideop
features[variable][] = node_submitted_fvideop
-features_exclude[dependencies][alw_fields] = alw_fields
-features_exclude[dependencies][alw_videop] = alw_videop
features_exclude[field_base][field_xiti_chapters] = field_xiti_chapters
features_exclude[field_instance][node-fvideop-field_xiti_chapters] = node-fvideop-field_xiti_chapters
features_exclude[taxonomy][xiti_chapters] = xiti_chapters
diff --git a/modules/features/foundation_videop/foundation_videop.module b/modules/features/foundation_videop/foundation_videop.module
index cb72418..25bee79 100644
--- a/modules/features/foundation_videop/foundation_videop.module
+++ b/modules/features/foundation_videop/foundation_videop.module
@@ -11,7 +11,6 @@ include_once 'foundation_videop.features.inc';
*/
function foundation_videop_menu() {
// Replace the entityreference autocomplete
-
$items = array();
$items['fvideop/autocomplete/single/%/%/%'] = array(
@@ -92,7 +91,10 @@ function foundation_videop_form_fvideop_node_form_alter(&$form, &$form_state, $f
$fields = field_info_instances('node', 'fvideop');
$langcode = $form['language']['#value'];
- foreach ($fields as $field_name => $field) {
+ foreach ($fields as $field_name => $field_instance) {
+ $field = field_info_field($field_name);
+ if ($field['translatable'] == 0) $langcode = LANGUAGE_NONE;
+
if (isset($form[$field_name])) {
$config = module_invoke_all('foundation_videop_fields', $field_name);
@@ -108,7 +110,7 @@ function foundation_videop_form_fvideop_node_form_alter(&$form, &$form_state, $f
if (isset($form[$field_name][$langcode][0])) {
unset($form[$field_name][$langcode][0]['_weight']);
- switch ($field['widget']['module']) {
+ switch ($field_instance['widget']['module']) {
case 'entityreference':
$form[$field_name][$langcode][0]['target_id']['#title'] = $form[$field_name][$langcode]['#title'];
break;
@@ -138,7 +140,7 @@ function foundation_videop_change_field(&$field, $name, $value) {
}
/**
- *
+ * Change the autocomplete_path and validation element
*/
function foundation_videop_change_entity_reference(&$field, $context) {
$instance = $context['instance'];
@@ -166,24 +168,6 @@ function foundation_videop_change_entity_reference(&$field, $context) {
}
/**
- * Gets the referenced video atom of the given video page node.
- *
- * @param Object $node the node object.
- * @return Object the video atom object or NULL if the video page doens't
- * reference a video atom.
- */
-function foundation_videop_get_video($node) {
- if ($node->type != 'fvideop') return NULL;
-
- $videop = entity_metadata_wrapper('node', $node);
- $video = $videop->field_fvideop_video->value();
-
- if (empty($video)) return NULL;
-
- return $video;
-}
-
-/**
* Menu callback: autocomplete the label of an entity.
*
* @param $type
@@ -249,7 +233,7 @@ function foundation_videop_autocomplete_access_callback($type, $field_name, $ent
}
/**
- *
+ * Function to validate the autocomplete entity reference
*/
function _foundation_videop_autocomplete_validate($element, &$form_state, $form) {
if (!empty($element['#value'])) {
@@ -277,6 +261,9 @@ function _foundation_videop_autocomplete_validate($element, &$form_state, $form)
/**
* Implements hook_views_data_alter():
+ *
+ * Remove the unsed fields from views
+ *
*/
function foundation_videop_views_data_alter(&$data) {
$fields = field_info_instances('node', 'fvideop');
@@ -305,3 +292,21 @@ function foundation_videop_views_data_alter(&$data) {
}
}
}
+
+/**
+ * Gets the referenced video atom of the given video page node.
+ *
+ * @param Object $node the node object.
+ * @return Object the video atom object or NULL if the video page doens't
+ * reference a video atom.
+ */
+function foundation_videop_get_video($node) {
+ if ($node->type != 'fvideop') return NULL;
+
+ $videop = entity_metadata_wrapper('node', $node);
+ $video = $videop->field_fvideop_video->value();
+
+ if (empty($video)) return NULL;
+
+ return $video;
+}
diff --git a/modules/features/foundation_videop/foundation_videop.strongarm.inc b/modules/features/foundation_videop/foundation_videop.strongarm.inc
index 2e8c3a6..613ac36 100644
--- a/modules/features/foundation_videop/foundation_videop.strongarm.inc
+++ b/modules/features/foundation_videop/foundation_videop.strongarm.inc
@@ -13,31 +13,15 @@ function foundation_videop_strongarm() {
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
$strongarm->api_version = 1;
- $strongarm->name = 'field_bundle_settings_node__fvideop';
+ $strongarm->name = 'entity_translation_settings_node__fvideop';
$strongarm->value = array(
- 'view_modes' => array(),
- 'extra_fields' => array(
- 'form' => array(
- 'metatags' => array(
- 'weight' => '22',
- ),
- 'path' => array(
- 'weight' => '20',
- ),
- 'redirect' => array(
- 'weight' => '19',
- ),
- 'xmlsitemap' => array(
- 'weight' => '21',
- ),
- 'language' => array(
- 'weight' => '18',
- ),
- ),
- 'display' => array(),
- ),
+ 'default_language' => 'xx-et-current',
+ 'hide_language_selector' => 0,
+ 'exclude_language_none' => 1,
+ 'lock_language' => 1,
+ 'shared_fields_original_only' => 0,
);
- $export['field_bundle_settings_node__fvideop'] = $strongarm;
+ $export['entity_translation_settings_node__fvideop'] = $strongarm;
$strongarm = new stdClass();
$strongarm->disabled = FALSE; /* Edit this to true to make a default strongarm disabled initially */
From 3736a7e4ae295ec2e5adc698e908ab32da7520bd Mon Sep 17 00:00:00 2001
From: lsantos-oq <luis.santos@openquest.pt>
Date: Thu, 17 Mar 2016 18:37:30 +0000
Subject: [PATCH 07/11] AFOUND-607 Change manual recommendation to unlimited
---
.../foundation_videop/foundation_videop.features.field_base.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/features/foundation_videop/foundation_videop.features.field_base.inc b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
index 6bc8f3b..015aae2 100644
--- a/modules/features/foundation_videop/foundation_videop.features.field_base.inc
+++ b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
@@ -223,7 +223,7 @@ function foundation_videop_field_default_field_bases() {
// Exported field_base: 'field_fvideop_m_recommendations'.
$field_bases['field_fvideop_m_recommendations'] = array(
'active' => 1,
- 'cardinality' => 1,
+ 'cardinality' => -1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_fvideop_m_recommendations',
From abb12eb298dd34039e56ee2149c78ac53c6bf94b Mon Sep 17 00:00:00 2001
From: lsantos-oq <luis.santos@openquest.pt>
Date: Thu, 7 Apr 2016 14:24:22 +0100
Subject: [PATCH 08/11] AFOUND-607 Modify the field translations, add generic
functions
---
.../foundation_videop.features.field_base.inc | 8 ++---
.../foundation_videop/foundation_videop.module | 37 ++++++++++++++++++++++
2 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/modules/features/foundation_videop/foundation_videop.features.field_base.inc b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
index 015aae2..ee249f6 100644
--- a/modules/features/foundation_videop/foundation_videop.features.field_base.inc
+++ b/modules/features/foundation_videop/foundation_videop.features.field_base.inc
@@ -54,7 +54,7 @@ function foundation_videop_field_default_field_bases() {
'settings' => array(
'entity_translation_sync' => FALSE,
),
- 'translatable' => 1,
+ 'translatable' => 0,
'type' => 'atom_reference',
);
@@ -223,7 +223,7 @@ function foundation_videop_field_default_field_bases() {
// Exported field_base: 'field_fvideop_m_recommendations'.
$field_bases['field_fvideop_m_recommendations'] = array(
'active' => 1,
- 'cardinality' => -1,
+ 'cardinality' => 1,
'deleted' => 0,
'entity_types' => array(),
'field_name' => 'field_fvideop_m_recommendations',
@@ -415,7 +415,7 @@ function foundation_videop_field_default_field_bases() {
'settings' => array(
'entity_translation_sync' => FALSE,
),
- 'translatable' => 1,
+ 'translatable' => 0,
'type' => 'atom_reference',
);
@@ -439,7 +439,7 @@ function foundation_videop_field_default_field_bases() {
'settings' => array(
'entity_translation_sync' => FALSE,
),
- 'translatable' => 1,
+ 'translatable' => 0,
'type' => 'atom_reference',
);
diff --git a/modules/features/foundation_videop/foundation_videop.module b/modules/features/foundation_videop/foundation_videop.module
index 25bee79..58329c2 100644
--- a/modules/features/foundation_videop/foundation_videop.module
+++ b/modules/features/foundation_videop/foundation_videop.module
@@ -310,3 +310,40 @@ function foundation_videop_get_video($node) {
return $video;
}
+
+/**
+ * Auxiliary function to retrieve video pages given an atom.
+ *
+ * @param integer $sid
+ * A scald atom SID.
+ *
+ * @return array|FALSE
+ * Video page node entities or FALSE if not found.
+ */
+function _foundation_videop_get_videop_by_atom_sid($sid) {
+ $query = new EntityFieldQuery();
+ $query->entityCondition('entity_type', 'node')
+ ->entityCondition('bundle', 'fvideop')
+ ->fieldCondition('field_fvideop_video', 'sid', $sid, '=');
+ $result = $query->execute();
+
+ if (isset($result['node'])) {
+ return entity_load('node', array_keys($result['node']));
+ }
+
+ return FALSE;
+}
+
+/**
+ * Auxiliary function to retrieve video pages given an atom base id.
+ *
+ * @param string $base_id
+ * The scald atom base id.
+ *
+ * @return array|FALSE
+ * Video page node entities or FALSE if not found.
+ */
+function _foundation_videop_get_videop_by_base_id($base_id) {
+ $sid = scald_opa_get_atom_sid_by_base_id($base_id);
+ return _foundation_videop_get_videop_by_atom_sid($sid);
+}
From 9b0bc51491580811ff3d6ee61c7f77189be1f036 Mon Sep 17 00:00:00 2001
From: lsantos-oq <luis.santos@openquest.pt>
Date: Thu, 7 Apr 2016 14:25:12 +0100
Subject: [PATCH 09/11] AFOUND-607 Add new module to create/update nodes from
OPA
---
.../modules/foundation_videop_opa/README.md | 20 ++
.../foundation_videop_opa.api.php | 36 +++
.../foundation_videop_opa.info | 6 +
.../foundation_videop_opa.module | 261 +++++++++++++++++++++
4 files changed, 323 insertions(+)
create mode 100755 modules/features/foundation_videop/modules/foundation_videop_opa/README.md
create mode 100644 modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.api.php
create mode 100644 modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.info
create mode 100644 modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.module
diff --git a/modules/features/foundation_videop/modules/foundation_videop_opa/README.md b/modules/features/foundation_videop/modules/foundation_videop_opa/README.md
new file mode 100755
index 0000000..9900f79
--- /dev/null
+++ b/modules/features/foundation_videop/modules/foundation_videop_opa/README.md
@@ -0,0 +1,20 @@
+Foundation Video page OPA integration
+===============================
+
+Automatically creates a video page node for a new OPA video atom and updates a video
+page's title, subtitle and short description with incoming OPA metadata updates.
+Also deletes a video page node when a video atom gets deleted.
+
+API
+---
+
+You can extend this module behaviors using two API hooks :
+ - hook_foundation_video_opa_videop_update : custom logic when creating/updating a video page from an atom.
+ - hook_foundation_videop_opa_videop_find : custom logic to find video page node from parameters.
+
+Testing
+-------
+
+For local testing purposes, you can use the ScaldOPA migration disabling the RabbitMQ parameter.
+Indeed, this server is not reachable locally and should not be used. OPA can be directly queried.
+A videop node must be created/updated each time a scald_opa atom is imported/updated.
diff --git a/modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.api.php b/modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.api.php
new file mode 100644
index 0000000..2ab6722
--- /dev/null
+++ b/modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.api.php
@@ -0,0 +1,36 @@
+<?php
+/**
+ * @file
+ * Hooks for foundation_videop_opa module.
+ */
+
+/**
+ * This hook is invoked before a video page node gets updated during OPA syncronisation.
+ * You can use this hook for insert/update processes as it gets called for both of them.
+ *
+ * @param object $node
+ * The video node object, passed by reference automatically.
+ * @param object $atom
+ * The video atom object, passed by reference automatically.
+ */
+function hook_foundation_videop_opa_videop_update($node, $atom) {
+ // Do something with the node
+}
+
+/**
+ * This hook is invoked when a video page node is being searched for given certain parameters.
+ * It allows other modules to set custom logic to find a video page for specific parameters.
+ * Default supported parameters are 'sid' and 'em' values.
+ *
+ * @param array $params
+ * Search parameters, e.g. Scald ID, EM number.
+ *
+ * @return array|FALSE
+ * Video page node entities or FALSE if not found.
+ */
+function hook_foundation_videop_opa_videop_find($params) {
+ $videopages = FALSE;
+ // Look up e.g. program nodes by EM number that reference a video page
+ // Return the found video pages
+ return $videopages;
+}
diff --git a/modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.info b/modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.info
new file mode 100644
index 0000000..de0bd38
--- /dev/null
+++ b/modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.info
@@ -0,0 +1,6 @@
+name = Foundation Video page OPA integration
+description = Automatically create a video page for an OPA video and keep its data synchronized.
+core = 7.x
+package = ARTE Foundation
+project = foundation_videop_opa
+dependencies[] = foundation_videop
diff --git a/modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.module b/modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.module
new file mode 100644
index 0000000..c4cb88d
--- /dev/null
+++ b/modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.module
@@ -0,0 +1,261 @@
+<?php
+/**
+ * @file
+ * Code for foundation video page synchronisation with OPA videos.
+ */
+
+/**
+ * Implements hook_scald_opa_migrate_insert().
+ *
+ * When a new scald atom is created from OPA sync,
+ * create and populate a video page node on the fly.
+ *
+ * @param object $atom
+ * The scald atom object.
+ */
+function foundation_videop_opa_scald_opa_migrate_insert($atom) {
+ $atom_wrapper = scald_opa_metadata_wrapper($atom);
+ $rights_end = $atom_wrapper->field_video_rights_until->value();
+
+ // Only create the video page node if atom rights are ok.
+ if (empty($rights_end) or $rights_end > time()) {
+ // Create a new video page if it doesn't exist yet
+ $videop = foundation_videop_opa_video_create_videop($atom);
+
+ // The video page might have been created before this video atom was available.
+ // Make sure the video page references the video atom
+ _foundation_videop_opa_video_ref_update($videop, $atom);
+ }
+}
+
+/**
+ * Implements hook_scald_opa_migrate_update().
+ *
+ * When a scald atom is updated from OPA sync,
+ * update (or create) video page nodes linked to the atom.
+ *
+ * @param object $atom
+ * The scald atom object.
+ */
+function foundation_videop_opa_scald_opa_migrate_update($atom) {
+ $videopages = foundation_videop_opa_find_videop(array('sid' => $atom->sid, 'em' => $atom->base_id));
+
+ if (empty($videopages)) {
+ // No video page exists, create a new one.
+ $atom_wrapper = scald_opa_metadata_wrapper($atom);
+ $rights_end = $atom_wrapper->field_video_rights_until->value();
+
+ // Only create the video page node if atom rights are ok.
+ if (empty($rights_end) or $rights_end > time()) {
+ _foundation_videop_opa_insert_videop_node($atom);
+ }
+ } else {
+ // At least one video page exists, update existing ones.
+ foreach ($videopages as $videopage) {
+ _foundation_videop_opa_update_videop_node($videopage, $atom);
+ }
+ }
+}
+
+/**
+ * Create a new videop node.
+ *
+ * @param object $atom
+ * The video atom object.
+ *
+ * @return object
+ * The new video page node.
+ */
+function _foundation_videop_opa_insert_videop_node($atom) {
+ $atom_wrapper = scald_opa_metadata_wrapper($atom);
+ $node = entity_create('node', array('type' => 'fvideop'));
+ $node->uid = 1;
+
+ // The first element in the JSON is the first language that entered.
+ // Use this for the default language of this node
+ $language = key($atom->data['json']);
+ $node->language = $language;
+
+ // Title.
+ $node->title = $atom_wrapper->language($language)->title->value();
+
+ // Video atom reference.
+ $node->field_fvideop_video[LANGUAGE_NONE][0]['sid'] = $atom_wrapper->sid->value();
+
+ // Status
+ $node->status = variable_get('foundation_fvideop_opa_node_status', 1);
+
+ // Save the node
+ node_save($node);
+
+ // Log this event
+ watchdog('foundation_videop_opa', 'New fvideop with title !title and linked to atom !sid created', array('!title' => $node->title, '!sid' => $atom->sid), WATCHDOG_DEBUG, l('node', 'node/' . $node->nid));
+
+ // Also call the update process now that we have the videop nid.
+ _foundation_videop_opa_update_videop_node($node, $atom, TRUE);
+
+ return $node;
+}
+
+/**
+ * Update a videop node.
+ *
+ * First time an atom is inserted it might just have the french version. Second time a german version might be attached.
+ * In this function we'll automatically add translations to the node as they are added to the atom, so we have translatable node titles.
+ *
+ * @param object $videopage
+ * The video page node to update.
+ * @param object $atom
+ * The video atom object.
+ * @param array $parents
+ * This video page parent nodes.
+ *
+ * @return object
+ * The video page node updated.
+ */
+function _foundation_videop_opa_update_videop_node($videopage, $atom, $update_custom = FALSE) {
+ if (module_exists('entity_translation')) {
+ $atom_wrapper = scald_opa_metadata_wrapper($atom);
+ $language_default = $videopage->language;
+
+ // Copy all titles over to videop, we need to check the JSON
+ // to see which languages we currently have as part of the atom.
+ $data = $atom->data['json'];
+ foreach ($data as $language => $json) {
+ // Fetch atom title field in the correct language.
+ $title = $atom_wrapper->language($language)->title->value();
+
+ // Add language information if we're translating this node.
+ if (!isset($videopage->translations->data[$language])) {
+ $videopage->translations->data[$language] = array(
+ 'entity_type' => 'node',
+ 'entity_id' => $videopage->nid,
+ 'language' => $language,
+ 'source' => $language_default,
+ 'uid' => $videopage->uid,
+ 'status' => 1,
+ 'translate' => 0,
+ );
+ }
+
+ // Title.
+ $videopage->title_field[$language][0]['value'] = $title;
+
+ if ($update_custom) {
+ // Body.
+ $videopage->body[$language][0]['teaser'] = $atom_wrapper->language($language)->shortDescription->value();
+ $videopage->body[$language][0]['value'] = $atom_wrapper->language($language)->fullDescription->value();
+
+ // Subtitle.
+ $videopage->field_fvideop_subtitle[$language][0]['value'] = $atom_wrapper->language($language)->subtitle->value();
+ }
+ }
+
+ // Give other modules a shot at enriching the updated video page node.
+ // No need to do drupal alter as arguments are objects are then passed by ref.
+ module_invoke_all('foundation_video_opa_videop_update', $videopage, $atom);
+
+ // Save the node.
+ node_save($videopage);
+ }
+}
+
+/**
+ * Implements hook_scald_atom_delete().
+ *
+ * When a scald_opa video atom gets deleted,
+ * also delete the associated video page nodes.
+ */
+function foundation_videop_opa_scald_atom_delete($atom) {
+ if ($atom->provider == 'scald_opa') {
+ if ($videopages = foundation_videop_opa_find_videop(array('sid' => $atom->sid, 'em' => $atom->base_id))) {
+ foreach ($videopages as $videopage) {
+ node_delete($videopage->nid);
+ }
+ }
+ }
+}
+
+/**
+ * Implements hook_action_info().
+ */
+function foundation_videop_opa_action_info() {
+ return array(
+ 'foundation_videop_opa_video_create_videop' => array(
+ 'type' => 'scald_atom',
+ 'label' => t('Create video page for video (if not exists yet)'),
+ 'configurable' => FALSE,
+ 'triggers' => array('', ),
+ ),
+ );
+}
+
+/**
+ * Action to create a video page for the atom.
+ *
+ * @param object $atom
+ * The video atom object.
+ * @param array $context
+ * An array of contextual data.
+ *
+ * @return object
+ * The new or existing video page node object.
+ */
+function foundation_videop_opa_video_create_videop($atom, $context = array()) {
+ $videopages = foundation_videop_opa_find_videop(array('sid' => $atom->sid, 'em' => $atom->base_id));
+ if (!$videopages) {
+ // No video page exists, create a new one.
+ $videopage = _foundation_videop_opa_insert_videop_node($atom);
+ } else {
+ // Only take the first one.
+ // @TODO maybe this need more refactoring later.
+ $videopage = array_shift($videopages);
+ }
+
+ return $videopage;
+}
+
+/**
+ * Find video pages given certain search parameters.
+ *
+ * @param array $params
+ * Search parameters as array.
+ * Can search with data like 'sid', 'em' and any module can add their own.
+ *
+ * @return array|FALSE
+ * Videop node entities or FALSE if not found.
+ */
+function foundation_videop_opa_find_videop($params) {
+ if (isset($params['sid']) && $videopages = _foundation_videop_get_videop_by_atom_sid($params['sid'])) {
+ return $videopages;
+ }
+
+ if (isset($params['em']) && $videopages = _foundation_videop_get_videop_by_base_id($params['em'])) {
+ return $videopages;
+ }
+
+ // Give other modules at shot at finding video pages.
+ $videopages = module_invoke_all('foundation_videop_opa_videop_find', $params);
+ if (!empty($videopages)) {
+ return $videopages;
+ }
+
+ return FALSE;
+}
+
+/**
+ * Helper function to reference a video atom with the given video page node.
+ *
+ * @param object $node
+ * The video page node object.
+ * @param object $atom
+ * The scald atom object.
+ */
+function _foundation_videop_opa_video_ref_update($node, $atom) {
+ $videop = entity_metadata_wrapper('node', $node);
+ $ref = $videop->field_videop_video->value();
+ if (empty($ref) || $ref->sid != $atom->sid) {
+ $node->field_videop_video[LANGUAGE_NONE][0]['sid'] = $atom->sid;
+ node_save($node);
+ }
+}
From d08e9156e5a7790821f49a60d2c9df59d51d26d0 Mon Sep 17 00:00:00 2001
From: lsantos-oq <luis.santos@openquest.pt>
Date: Thu, 14 Apr 2016 15:17:40 +0100
Subject: [PATCH 10/11] AFOUND-607 Correct typos
---
.../features/foundation_videop/modules/foundation_videop_opa/README.md | 2 +-
.../modules/foundation_videop_opa/foundation_videop_opa.module | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/features/foundation_videop/modules/foundation_videop_opa/README.md b/modules/features/foundation_videop/modules/foundation_videop_opa/README.md
index 9900f79..ddabe17 100755
--- a/modules/features/foundation_videop/modules/foundation_videop_opa/README.md
+++ b/modules/features/foundation_videop/modules/foundation_videop_opa/README.md
@@ -9,7 +9,7 @@ API
---
You can extend this module behaviors using two API hooks :
- - hook_foundation_video_opa_videop_update : custom logic when creating/updating a video page from an atom.
+ - hook_foundation_videop_opa_videop_update : custom logic when creating/updating a video page from an atom.
- hook_foundation_videop_opa_videop_find : custom logic to find video page node from parameters.
Testing
diff --git a/modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.module b/modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.module
index c4cb88d..1bf1663 100644
--- a/modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.module
+++ b/modules/features/foundation_videop/modules/foundation_videop_opa/foundation_videop_opa.module
@@ -153,7 +153,7 @@ function _foundation_videop_opa_update_videop_node($videopage, $atom, $update_cu
// Give other modules a shot at enriching the updated video page node.
// No need to do drupal alter as arguments are objects are then passed by ref.
- module_invoke_all('foundation_video_opa_videop_update', $videopage, $atom);
+ module_invoke_all('foundation_videop_opa_videop_update', $videopage, $atom);
// Save the node.
node_save($videopage);
From 18762946e3e6d2be8c1e158c31330ae3dd05de56 Mon Sep 17 00:00:00 2001
From: lsantos-oq <luis.santos@openquest.pt>
Date: Wed, 3 Aug 2016 17:35:26 +0100
Subject: [PATCH 11/11] AFOUND-607 Write the intructions
---
modules/features/foundation_videop/README.md | 66 ++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/modules/features/foundation_videop/README.md b/modules/features/foundation_videop/README.md
index 1ac0045..aad203d 100644
--- a/modules/features/foundation_videop/README.md
+++ b/modules/features/foundation_videop/README.md
@@ -2,3 +2,69 @@ Foundation Video Page
==============
Feature defining the content type for Video Page.
+
+Create a generic node type `fvideop` with this fields:
+Title - title_field
+Body - body
+Video - field_fvideop_video
+Description/ Headline - field_fvideop_description_headline
+Social Headline - field_fvideop_social_headline
+Gallery - field_fvideop_gallery
+Section Title - field_fvideop_section_title
+Section Content - field_fvideop_section_content
+Bonus videos - field_fvideop_bonus_videos
+Partner - field_fvideop_partner
+Event - field_fvideop_event
+Genre - field_fvideop_genre
+Keywords - field_fvideop_keywords
+Coutry - field_fvideop_country
+Manual Recommendations - field_fvideopmrecommendations
+Subtitle - field_fvideop_subtitle
+
+Changing the fields to work in your platform
+---
+
+Use the hook_foundation_videop_fields to define your settings on fields
+
+Eg:
+```
+function hook_foundation_videop_fields($field_name = NULL) {
+ $fields = array(
+ // Hide that Video teaser field
+ 'field_fvideop_video_teaser' => array(
+ 'hide' => TRUE,
+ ),
+ // Change the name and description of body
+ 'body' => array(
+ 'title' => t('Editorial Text'),
+ 'description' => t('If left empty, the body field is taken from the associated video atom. If you want to overwrite that text, you can fill out a value here.'),
+ ),
+ // Define the entity reference partner and the related settings
+ 'field_fvideop_partner' => array(
+ 'entity_reference' => TRUE,
+ 'settings' => array(
+ 'entity_translation_sync' => FALSE,
+ 'handler' => 'base',
+ 'handler_settings' => array(
+ 'behaviors' => array(
+ 'views-select-list' => array(
+ 'status' => 0,
+ ),
+ ),
+ 'sort' => array(
+ 'type' => 'none',
+ ),
+ 'target_bundles' => array(
+ 'partner' => 'partner',
+ ),
+ ),
+ 'target_type' => 'node',
+ ),
+ ),
+ );
+
+ if (isset($fields[$field_name])) return $fields[$field_name];
+
+ return array();
+}
+```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment