diff --git a/profiles/wcm_base/CHANGELOG.txt b/profiles/wcm_base/CHANGELOG.txt index 861d1ae0442698db74f95da60bffce453d43a12c..1dcd4d515441733706f2da113b325626bf6e5fb7 100644 --- a/profiles/wcm_base/CHANGELOG.txt +++ b/profiles/wcm_base/CHANGELOG.txt @@ -1,3 +1,7 @@ +WCM Base 7.x-1.12, 2019-03-07 +----------------------------- +- WCM Base: Updated Fieldable Panels Panes to 1.12. + WCM Base 7.x-1.12-rc3, 2019-03-05 --------------------------------- - WCM Base: @@ -5,8 +9,8 @@ WCM Base 7.x-1.12-rc3, 2019-03-05 - Updated Better Exposed Filters to 3.6. - Updated ctools to 1.15. - Updated Features to 2.11. - - Updated Fieldable Panels Panes to 1.11. - Updated Google Analytics to 2.6. + - Updated Fieldable Panels Panes to 1.11. - Updated Media to 2.21. - Updated Media Youtube to 3.8. - Updated Menu Block to 2.8. diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/CHANGELOG.txt b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/CHANGELOG.txt index 438bfca1675f91e45e692b68bb62cb272db585af..04b49a8f46270908d09e180aeaa4d727f18d9f84 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/CHANGELOG.txt +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/CHANGELOG.txt @@ -1,3 +1,42 @@ +Fieldable Panels Panes 7.x-1.12, 2019-03-04 +------------------------------------------- +#2826182 by Arrow: Inversed logic for checking if the title should be used. +#2825835 by Pol: Avoid errors with Panels when a FPP was deleted or otherwise + doesn't exist. +By DamienMcKenna: Remove the CTools/Panels version requirenents. +#2826205 by DamienMcKenna, ron_s, Postovan Dumitru, wilei, dat deaf drupaler, + potassiumchloride, Rudi Teschner, Pol, Arrow, ec-adam, maxplus, arosboro, + kmonty, wylbur, langelhc, smaz, Manuel Garcia, dan.munn, Nitebreed, vkakani, + Bram Esposito: Broken links for Fieldable Panels Panes in admin menu after + update. +#2936307 by cboyden, DamienMcKenna: View functions handle langcode argument + differently. +#2867561 by Chris Burge, DamienMcKenna: Allow CTools Content Type plugin access + to be altered. +#2865462 by Chris Burge, DamienMcKenna: Allow CTools content type to be altered. +#2889278 by cboyden, dsnopek: On the Views link fields, allow hiding links if + the FPP is not reusable. +#2982204 by DamienMcKenna, shaysmith: Database updates may not complete for + fieldable_panels_panes_update_7108. +#2962952 by DamienMcKenna, dsnopek, cboyden: Implement + hook_panelizer_clone_panelizer(). +#3019270 by Asacolips, wildhostile, Anybody: Can't access to drupal 7 admin + (err_too_many_redirects). +#3028536 by DamienMcKenna: Add 'use strict' to the JS. +#2916627 by DamienMcKenna, Manuel Garcia: Add a composer.json file to document + the dependencies. +#3029146 by Manuel Garcia: Add test dependency for services module integration. +#3036702 by DamienMcKenna: Fix tests for 7.x-1.x branch. +#3036701 by DamienMcKenna: Coding standards fixes for FPP. +#3035271 by DamienMcKenna, featherbelly: Remove `composer.json`. +#3037423 by Mixologic, DamienMcKenna: Add libraries as a test dependency for + #2163581. +#2163581 by Manuel Garcia, DamienMcKenna, indytechcook, timaholt, dww, + Mixologic: Add Services resources. +#3037380 by DamienMcKenna: List dependencies in the tests, tidy up setUp() + methods. + + Fieldable Panels Panes 7.x-1.11, 2016-11-05 ------------------------------------------- #2688577 by rigoucr: Wrong function name for update 7114. diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable-panels-pane.tpl.php b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable-panels-pane.tpl.php index 2c40a31fd98a77645f674e7a470b6d01b429283e..192d332f6054ddafe17be6d3b033b1a8b649fcd8 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable-panels-pane.tpl.php +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable-panels-pane.tpl.php @@ -1,3 +1,19 @@ +<?php + +/** + * @file + * Default template for a Fieldable Panels Panes entity. + */ + +/** + * Available variables. + * + * $classes - String containing all of the classes defined for this object. + * $attributes - String containing additional HTML attributes to be displayed. + * $title_suffix - Render array. + * $content - Render array containing all field data to be output. + */ +?> <div class="<?php print $classes; ?>"<?php print $attributes; ?>> <?php print render($title_suffix); ?> <?php print render($content); ?> diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.api.php b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.api.php index a8f0b810d796ee09c2bbe47e2bbce0cfb789c926..83e9a6e90b4ead963fd7fdf939ba5aa86041bc2f 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.api.php +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.api.php @@ -1,4 +1,5 @@ <?php + /** * @file * Hooks provided by the Fieldable Panels Panes module. @@ -12,7 +13,7 @@ /** * Respond to fieldable panels pane deletion. * - * @param $panels_pane + * @param object $panels_pane * The fieldable panels pane that is being deleted. * * @ingroup fieldable_panels_pane_api_hooks @@ -26,7 +27,7 @@ function hook_fieldable_panels_pane_delete($panels_pane) { /** * Respond to creation of a new fieldable panels pane. * - * @param $panels_pane + * @param object $panels_pane * The fieldable that is being created. * * @ingroup fieldable_panels_pane_api_hooks @@ -43,7 +44,7 @@ function hook_fieldable_panels_pane_insert($panels_pane) { /** * Act on a fieldable panels pane being inserted or updated. * - * @param $panels_pane + * @param object $panels_pane * The fieldable panels pane that is being inserted or updated. * * @ingroup fieldable_panels_pane_api_hooks @@ -55,7 +56,7 @@ function hook_fieldable_panels_pane_presave($panels_pane) { /** * Respond to updates to a fieldable panels pane. * - * @param $panels_pane + * @param object $panels_pane * The fieldable panels pane that is being updated. * * @ingroup fieldable_panels_pane_api_hooks @@ -70,11 +71,11 @@ function hook_fieldable_panels_pane_update($panels_pane) { /** * Act on a fieldable panels pane that is being assembled before rendering. * - * @param $panels_pane + * @param object $panels_pane * The fieldable panels pane that is being assembled for rendering. - * @param $view_mode + * @param string $view_mode * The $view_mode parameter. - * @param $langcode + * @param string $langcode * The language code used for rendering. * * @see hook_entity_view() @@ -100,7 +101,7 @@ function hook_fieldable_panels_pane_view($panels_pane, $view_mode, $langcode) { * All of the FPP entities for this bundle indexed by their CTools subtype, * e.g. fpid:123, vid:123, uuid:123. */ -function hook_fieldable_panels_panes_content_types_alter(&$types, $bundle, $entities) { +function hook_fieldable_panels_panes_content_types_alter(array &$types, $bundle, array $entities) { foreach ($types as $name => &$type) { $type['icon'] = 'icon_funnyface.png'; } @@ -111,12 +112,12 @@ function hook_fieldable_panels_panes_content_types_alter(&$types, $bundle, $enti * * @param string $op * The operation to be performed. - * @param $entity + * @param object $entity * The fieldable panels pane that is being accessed. - * @param $account + * @param object|null $account * The user account whose access should be checked. * - * @return TRUE|FALSE|NULL + * @return bool|null * Returns TRUE to allow access, FALSE to deny, or NULL to pass the access * decision off to the next hook or the module itself. * @@ -130,6 +131,45 @@ function hook_fieldable_panels_panes_access($op, $entity = NULL, $account = NULL return NULL; } +/** + * Allow other modules to modify access to the FPP CTools content type. + * + * @param bool $return + * Value to determine if edit access is granted to FPP entity. + * @param array $content_type + * The CTools content type plugin. + * @param array $subtype + * The individual FPP entity being evaluated for edit access. + * @param array $view_mode + * The view mode of the FPP entity being evaluated for edit access. + */ +function hook_fieldable_panels_pane_content_type_edit_form_access_alter(&$return, array $content_type, array $subtype, array $view_mode) { + // For button and quote FPP bundles, deny edit access from Panels. + if ($subtype['bundle'] == 'button' || $subtype['bundle'] == 'quote') { + $return = FALSE; + } +} + +/** + * Allow other modules to modify the Fieldable Panels Pane CTools content type. + * + * @param array $content_type + * The individual content type to be returned. + * @param string $subtype_id + * The subtype id of the fieldable panel pane being altered for render. + * @param array $plugin + * The CTools content type plugin. + */ +function hook_fieldable_panels_pane_content_type_alter(array &$content_type, $subtype_id, array $plugin) { + // For button FPP bundles, always show the latest revision. + if ($content_type['bundle'] == 'button' && substr($subtype_id, 0, 4) === 'vid:') { + $vid = substr($subtype_id, strpos($subtype_id, ':') + 1); + $fpid = db_query('SELECT f.fpid FROM {fieldable_panels_panes} f WHERE f.vid = :vid', array(':vid' => $vid))->fetchField(); + $content_type['name'] = 'fpid:' . $fpid; + $content_type['entity_id'] = 'fpid:' . $fpid; + } +} + /** * @} End of "addtogroup hooks". */ diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.info b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.info index b9d3520ba42b748d22090cef4ebf34e8c0709dba..c7d11048e2ba76a461378c064e3cf57d3a840b4d 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.info +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.info @@ -2,8 +2,8 @@ name = "Fieldable Panels Panes" description = "Allow the creation of fieldable panels pane entities." package = "Panels" core = "7.x" -dependencies[] = ctools (>= 1.8) -dependencies[] = panels (>= 3.5) +dependencies[] = ctools +dependencies[] = panels dependencies[] = views configure = admin/structure/fieldable-panels-panes @@ -60,13 +60,19 @@ files[] = tests/fpp.with_panelizer.test test_dependencies[] = pathauto files[] = tests/fpp.with_pathauto.test +; Test the interaction with the Services module. Note: the rest_service +; submodule that the test depends upon also requires libraries, hence why it is +; listed here too. +test_dependencies[] = libraries +test_dependencies[] = services +files[] = tests/fpp.services.test + ; Test the node revisions workflow with Revisioning module. test_dependencies[] = revisioning files[] = tests/fpp.with_revisioning.test -; Information added by Drupal.org packaging script on 2016-11-05 -version = "7.x-1.11" +; Information added by Drupal.org packaging script on 2019-03-04 +version = "7.x-1.12" core = "7.x" project = "fieldable_panels_panes" -datestamp = "1478371741" - +datestamp = "1551731287" diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.install b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.install index efe1ea943e309f18a35205158d0d1f87772fd69f..c381980518d089bdd51b6ecd7f242d7f87619052 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.install +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.install @@ -1,7 +1,8 @@ <?php + /** * @file - * fieldable panel panes install file + * Fieldable Panels Panes install file. */ /** @@ -19,7 +20,6 @@ function fieldable_panels_panes_install() { } } - /** * Implements hook_uninstall(). */ @@ -184,7 +184,7 @@ function fieldable_panels_panes_schema() { 'length' => 255, ), 'log' => array( - 'description' => t('A log message associated with the revision.'), + 'description' => 'A log message associated with the revision.', 'type' => 'text', 'size' => 'big', ), @@ -239,7 +239,6 @@ function fieldable_panels_panes_schema() { 'primary key' => array('name'), ); - // Optional cache table for entitycache support. $schema['cache_entity_fieldable_panels_pane'] = drupal_get_schema_unprocessed('system', 'cache'); $schema['cache_entity_fieldable_panels_pane']['description'] = 'Cache table used to store fieldable_panels_pane entity records.'; @@ -251,13 +250,12 @@ function fieldable_panels_panes_schema() { * Add UUID support. */ function fieldable_panels_panes_update_7101(&$sandbox) { - - // Make sure to add UUID field + // Make sure to add UUID field. if (!db_field_exists('fieldable_panels_panes', 'uuid')) { db_add_field('fieldable_panels_panes', 'uuid', array('type' => 'char', 'length' => 36, 'default' => '', 'description' => 'The Universally Unique Identifier.')); } - // Make sure to add VUUID field + // Make sure to add VUUID field. if (!db_field_exists('fieldable_panels_panes_revision', 'vuuid')) { db_add_field('fieldable_panels_panes_revision', 'vuuid', array('type' => 'char', 'length' => 36, 'default' => '', 'description' => 'The Universally Unique Identifier.')); } @@ -283,7 +281,7 @@ function fieldable_panels_panes_update_7103(&$sandbox) { return t('Theme registry cache has been cleared.'); } -/* +/** * Update menu paths. */ function fieldable_panels_panes_update_7104(&$sandbox) { @@ -304,7 +302,7 @@ function fieldable_panels_panes_update_7105() { * Add language column. */ function fieldable_panels_panes_update_7106() { - // Make sure to add language field + // Make sure to add language field. if (!db_field_exists('fieldable_panels_panes', 'language')) { db_add_field('fieldable_panels_panes', 'language', array( 'description' => 'The {languages}.language of this entity.', @@ -328,56 +326,56 @@ function fieldable_panels_panes_update_7107() { } /** - * Adding Fieldable Panels Panes Type table and saving existing bundles to - * database. + * Adding Fieldable Panels Panes Type table and saving existing bundles. */ function fieldable_panels_panes_update_7108() { ctools_include('export'); $messages = array(); - // Copied from fieldable_panels_panes_schema() because the schema should not - // be directly used during hook_update_N. - $schema['fieldable_panels_pane_type'] = array( - 'description' => 'Entity bundle table for panel pane content.', - 'fields' => array( - 'name' => array( - 'description' => 'The machine-readable name of this type.', - 'type' => 'varchar', - 'length' => 255, - 'not null' => TRUE, - 'default' => '', + if (!db_table_exists('fieldable_panels_pane_type')) { + // Copied from fieldable_panels_panes_schema() because the schema should not + // be directly used during hook_update_N. + $schema['fieldable_panels_pane_type'] = array( + 'description' => 'Entity bundle table for panel pane content.', + 'fields' => array( + 'name' => array( + 'description' => 'The machine-readable name of this type.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + ), + 'title' => array( + 'description' => 'The human-readable name of this type.', + 'type' => 'varchar', + 'length' => 255, + 'not null' => TRUE, + 'default' => '', + 'translatable' => TRUE, + ), + 'description' => array( + 'description' => 'A brief description of this type.', + 'type' => 'text', + 'size' => 'big', + 'not null' => TRUE, + ), ), - 'title' => array( - 'description' => 'The human-readable name of this type.', - 'type' => 'varchar', - 'length' => 255, - 'not null' => TRUE, - 'default' => '', - 'translatable' => TRUE, - ), - 'description' => array( - 'description' => 'A brief description of this type.', - 'type' => 'text', - 'size' => 'big', - 'not null' => TRUE, + 'export' => array( + 'admin_title' => 'title', + 'admin_description' => 'description', + 'api' => array( + 'owner' => 'fieldable_panels_panes', + 'api' => 'fieldable_panels_pane_type', + 'minimum_version' => 1, + 'current_version' => 1, + ), ), - ), - 'export' => array( - 'admin_title' => 'title', - 'admin_description' => 'description', - 'api' => array( - 'owner' => 'fieldable_panels_panes', - 'api' => 'fieldable_panels_pane_type', - 'minimum_version' => 1, - 'current_version' => 1, - ), - ), - 'primary key' => array('name'), - ); - + 'primary key' => array('name'), + ); - // Add the new table for storing bundles. - db_create_table('fieldable_panels_pane_type', $schema['fieldable_panels_pane_type']); + // Add the new table for storing bundles. + db_create_table('fieldable_panels_pane_type', $schema['fieldable_panels_pane_type']); + } // Store possible existing bundles provided by other modules. $bundles = array(); @@ -444,8 +442,9 @@ function fieldable_panels_panes_update_7111() { } /** - * Update all Panelizer displays to point non-reusable FPPs to the vid instead - * of the fpid. + * Update all Panelizer displays to point non-reusable FPPs to the vid. + * + * (instead of the fpid) */ function fieldable_panels_panes_update_7112(&$sandbox) { if (!module_exists('panelizer')) { @@ -456,6 +455,7 @@ function fieldable_panels_panes_update_7112(&$sandbox) { // variable won't be defined before it's checked for. The simplest approach // is to manually rerun the updates. // + // @code // /** // * Enable the FPP revision locking feature. // */ @@ -469,7 +469,7 @@ function fieldable_panels_panes_update_7112(&$sandbox) { // function MYMODULE_update_7101(&$sandbox) { // return fieldable_panels_panes_update_7112($sandbox); // } - // + // @endcode // // A more correct approach is to use hook_update_dependencies to ensure that // the updates happen in the correct order. This may not work because if the @@ -477,6 +477,7 @@ function fieldable_panels_panes_update_7112(&$sandbox) { // until the caches are cleared, which may not happen until after the updates // are ran, thus the updates not running in the correct order. // + // @code // /** // * Implements hook_update_dependencies(). // */ @@ -500,16 +501,14 @@ function fieldable_panels_panes_update_7112(&$sandbox) { // function MYMODULE_update_7100() { // variable_set('fpp_revision_locking', 'lock'); // } - // + // @endcode // // An alternative solution would be to rerun the updates. - if (variable_get('fpp_revision_locking', 'lock') != 'lock') { return t('Pane locking is not enabled, so nothing to do.'); } // Update all Panelizer displays. - // The first time through, work out how many records need to be updated. if (!isset($sandbox['progress'])) { $sandbox['progress'] = 0; @@ -572,8 +571,9 @@ function fieldable_panels_panes_update_7112(&$sandbox) { } /** - * Update all Panel Nodes displays to point non-reusable FPPs to the vid instead - * of the fpid. + * Update all Panel Nodes displays to point non-reusable FPPs to the vid. + * + * (instead of the fpid) */ function fieldable_panels_panes_update_7113() { if (!module_exists('panels_node')) { @@ -584,6 +584,7 @@ function fieldable_panels_panes_update_7113() { // variable won't be defined before it's checked for. The simplest approach // is to manually rerun the updates. // + // @code // /** // * Enable the FPP revision locking feature. // */ @@ -597,7 +598,7 @@ function fieldable_panels_panes_update_7113() { // function MYMODULE_update_7101(&$sandbox) { // return fieldable_panels_panes_update_7113($sandbox); // } - // + // @endcode // // A more correct approach is to use hook_update_dependencies to ensure that // the updates happen in the correct order. This may not work because if the @@ -605,6 +606,7 @@ function fieldable_panels_panes_update_7113() { // until the caches are cleared, which may not happen until after the updates // are ran, thus the updates not running in the correct order. // + // @code // /** // * Implements hook_update_dependencies(). // */ @@ -628,10 +630,9 @@ function fieldable_panels_panes_update_7113() { // function MYMODULE_update_7100() { // variable_set('fpp_revision_locking', 'lock'); // } - // + // @endcode // // An alternative solution would be to rerun the updates. - if (variable_get('fpp_revision_locking', 'lock') != 'lock') { return t('Pane locking is not enabled, so nothing to do.'); } @@ -720,8 +721,9 @@ function fieldable_panels_panes_update_7114() { } /** - * Update all Panelizer displays to point non-reusable FPPs to the vuuid instead - * of the uuid. + * Update all Panelizer displays to point non-reusable FPPs to the vuuid. + * + * (instead of the uuid) */ function fieldable_panels_panes_update_7115(&$sandbox) { if (!module_exists('panelizer')) { @@ -732,6 +734,7 @@ function fieldable_panels_panes_update_7115(&$sandbox) { // variable won't be defined before it's checked for. The simplest approach // is to manually rerun the updates. // + // @code // /** // * Enable the FPP revision locking feature. // */ @@ -745,7 +748,7 @@ function fieldable_panels_panes_update_7115(&$sandbox) { // function MYMODULE_update_7101(&$sandbox) { // return fieldable_panels_panes_update_7115($sandbox); // } - // + // @endcode // // A more correct approach is to use hook_update_dependencies to ensure that // the updates happen in the correct order. This may not work because if the @@ -753,6 +756,7 @@ function fieldable_panels_panes_update_7115(&$sandbox) { // until the caches are cleared, which may not happen until after the updates // are ran, thus the updates not running in the correct order. // + // @code // /** // * Implements hook_update_dependencies(). // */ @@ -776,16 +780,14 @@ function fieldable_panels_panes_update_7115(&$sandbox) { // function MYMODULE_update_7100() { // variable_set('fpp_revision_locking', 'lock'); // } - // + // @endcode // // An alternative solution would be to rerun the updates. - if (variable_get('fpp_revision_locking', 'lock') != 'lock') { return t('Pane locking is not enabled, so nothing to do.'); } // Update all Panelizer displays. - // The first time through, work out how many records need to be updated. if (!isset($sandbox['progress'])) { $sandbox['progress'] = 0; @@ -848,8 +850,9 @@ function fieldable_panels_panes_update_7115(&$sandbox) { } /** - * Update all Panel Nodes displays to point non-reusable FPPs to the vuuid - * instead of the uuid. + * Update all Panel Nodes displays to point non-reusable FPPs to the vuuid. + * + * (instead of the uuid) */ function fieldable_panels_panes_update_7116(&$sandbox) { if (!module_exists('panels_node')) { @@ -860,6 +863,7 @@ function fieldable_panels_panes_update_7116(&$sandbox) { // variable won't be defined before it's checked for. The simplest approach // is to manually rerun the updates. // + // @code // /** // * Enable the FPP revision locking feature. // */ @@ -873,7 +877,7 @@ function fieldable_panels_panes_update_7116(&$sandbox) { // function MYMODULE_update_7101(&$sandbox) { // return fieldable_panels_panes_update_7116($sandbox); // } - // + // @endcode // // A more correct approach is to use hook_update_dependencies to ensure that // the updates happen in the correct order. This may not work because if the @@ -881,6 +885,7 @@ function fieldable_panels_panes_update_7116(&$sandbox) { // until the caches are cleared, which may not happen until after the updates // are ran, thus the updates not running in the correct order. // + // @code // /** // * Implements hook_update_dependencies(). // */ @@ -904,10 +909,9 @@ function fieldable_panels_panes_update_7116(&$sandbox) { // function MYMODULE_update_7100() { // variable_set('fpp_revision_locking', 'lock'); // } - // + // @endcode // // An alternative solution would be to rerun the updates. - if (variable_get('fpp_revision_locking', 'lock') != 'lock') { return t('Pane locking is not enabled, so nothing to do.'); } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.module b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.module index 8f190adecf9e36a330db124fb76f770b8abe7a64..af5efbacb98492458686d592c52d661ea325314a 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.module +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.module @@ -2,15 +2,14 @@ /** * @file - * * Maintains an entity that appears as panel pane content. */ // ------------------------------------------------------------------------- -// Drupal core hooks +// Drupal core hooks. /** - * Implements hook_entity_info() + * Implements hook_entity_info(). */ function fieldable_panels_panes_entity_info() { $info = array(); @@ -42,7 +41,8 @@ function fieldable_panels_panes_entity_info() { 'id' => 'fpid', 'revision' => 'vid', 'bundle' => 'bundle', - 'label' => 'title', // This key is required for proper integration with Title module. + 'label' => 'title', + // This key is required for proper integration with Title module. 'language' => 'language', 'uuid' => 'uuid', 'revision uuid' => 'vuuid', @@ -52,7 +52,7 @@ function fieldable_panels_panes_entity_info() { 'label callback' => 'fieldable_panels_panes_entity_label_callback', 'uri callback' => 'fieldable_panels_panes_entity_uri_callback', 'view modes' => array( - // @todo we should support view modes. + // @todo Should support view modes. 'full' => array( 'label' => t('Full'), 'custom settings' => FALSE, @@ -77,8 +77,8 @@ function fieldable_panels_panes_entity_info() { 'translation' => array( 'entity_translation' => array( 'class' => 'EntityTranslationFieldablePanelsPaneHandler', - 'base path' => 'admin/structure/fieldable-panels-panes/view/%fieldable_panels_panes', - 'edit path' => 'admin/structure/fieldable-panels-panes/view/%fieldable_panels_panes/edit', + 'base path' => 'admin/structure/fieldable-panels-panes/view/%fieldable_panels_panes', + 'edit path' => 'admin/structure/fieldable-panels-panes/view/%fieldable_panels_panes/edit', 'path wildcard' => '%fieldable_panels_panes', ), ), @@ -203,10 +203,9 @@ function fieldable_panels_panes_field_extra_fields() { function fieldable_panels_panes_field_extra_fields_display_alter(&$displays, $context) { if ($context['entity_type'] == 'fieldable_panels_pane' && $context['view_mode'] == 'full') { // Hide display of the title field on the 'full' view mode (because it gets - // displayed as the Pane title). - - // Ensure the 'title' key exists, since some other modules may have remove it. This - // is the case of the Title module for example. + // displayed as the Pane title). Ensure the 'title' key exists, since some + // other modules may have remove it. This is the case of the Title module + // for example. if (isset($displays['title'])) { $displays['title']['visible'] = FALSE; } @@ -214,7 +213,7 @@ function fieldable_panels_panes_field_extra_fields_display_alter(&$displays, $co } /** - * Implements hook_menu() + * Implements hook_menu(). */ function fieldable_panels_panes_menu() { $items = array(); @@ -420,7 +419,6 @@ function fieldable_panels_panes_menu() { 'weight' => -10, ) + $base; - // Settings. $items['admin/structure/fieldable-panels-panes/settings'] = array( 'title' => 'Settings', @@ -474,7 +472,7 @@ function fieldable_panels_panes_permission() { } /** - * Implements hook_theme() + * Implements hook_theme(). */ function fieldable_panels_panes_theme() { return array( @@ -509,15 +507,14 @@ function fieldable_panels_panes_admin_menu_map() { /** * Implements hook_admin_menu_map_alter(). - * - * Add mapping for the individual fields if the Field UI module is enabled, - * and the mappings are not already added by field_ui_admin_menu_map(). */ function fieldable_panels_panes_admin_menu_map_alter(array &$map) { if (!module_exists('field_ui')) { return; } + // Add mapping for the individual fields if the Field UI module is enabled, + // and the mappings are not already added by field_ui_admin_menu_map(). $bundles = array(); $info = entity_get_info('fieldable_panels_pane'); foreach ($info['bundles'] as $bundle_name => $bundle_info) { @@ -555,7 +552,7 @@ function fieldable_panels_panes_flush_caches() { } /** - * Implementation of hook_panels_dashboard_blocks(). + * Implements hook_panels_dashboard_blocks(). */ function fieldable_panels_panes_panels_dashboard_blocks(&$vars) { ctools_include('export'); @@ -611,6 +608,14 @@ function fieldable_panels_panes_panels_dashboard_blocks(&$vars) { * Properly format the type from the URL version to the internal version. */ function fieldable_panels_pane_type_load($type) { + // If the type is not set or equals 'view', return FALSE. This appears to be + // caused by incorrect menu item ordering, but it is still unclear why it + // happens. + // @todo Work out the root cause of this happening. + if (empty($type) || $type == 'view') { + return FALSE; + } + $type = str_replace('-', '_', $type); $entity_info = entity_get_info('fieldable_panels_pane'); @@ -625,17 +630,17 @@ function fieldable_panels_pane_type_load($type) { if ($type == 'manage' && (arg(5) == 'fields' || arg(5) == 'display')) { drupal_goto('admin/structure/fieldable-panels-panes/' . arg(4) . '/' . arg(5)); } - - // If nothing else was found, redirect to the main FPP admin page. - drupal_set_message(t('Unable to load the "@type" Fieldable Panels Pane type.', array('@type' => $type))); - drupal_goto('admin/structure/fieldable-panels-panes'); + else { + // If nothing else, return false. + return FALSE; + } } } /** * @depricated Backwards compatability layer. * - * @see fieldable_panels_pane_type_load(). + * @see fieldable_panels_pane_type_load() */ function fieldable_panels_panes_type_load($type) { return fieldable_panels_pane_type_load($type); @@ -656,23 +661,16 @@ function fieldable_panels_panes_entities_title($type) { /** * Title callback for fieldable panels panes exportable items. * - * @param $item + * @param object $item * A %ctools_export_ui object. + * + * @return string + * The title. */ function fieldable_panels_pane_type_title($item) { return $item->title; } -/** - * Ensure an entity can be accessed via URL. - * - * This requires only administrative access. - */ -/* -function fieldable_panels_panes_access($entity) { - return $entity && user_access('administer fieldable panels panes'); -} -*/ /** * Provide a safe title for an entity from the entity. */ @@ -691,8 +689,8 @@ function fieldable_panels_panes_entity_title($entity) { /** * Access callback to set a revision of a fieldable panel pane as current. * - * @param object $entity_info - * A fieldable panel pane object. + * @param object $entity + * A Fieldable Panels Pane object. * * @return bool * TRUE if the specific revision of the panel pane can be set as the current @@ -703,10 +701,10 @@ function fieldable_panels_panes_entity_make_current_access($entity) { } // ------------------------------------------------------------------------- -// CTools hooks +// CTools hooks. /** - * Implements hook_ctools_plugin_directory() + * Implements hook_ctools_plugin_directory(). */ function fieldable_panels_panes_ctools_plugin_directory($owner, $plugin_type) { if ($owner == 'ctools' && $plugin_type == 'export_ui') { @@ -726,6 +724,7 @@ function fieldable_panels_panes_ctools_plugin_directory($owner, $plugin_type) { * Check if the user has 'update' access for an FPP object. * * @param mixed $argument + * Should contain an array element "entity_id" with the ID of an FPP object. * * @return bool * Whether or not the user has access to update an FPP object. @@ -819,10 +818,10 @@ function fieldable_panels_panes_ctools_access_clear($argument) { } // ------------------------------------------------------------------------- -// Views hooks +// Views hooks. /** - * Implements hook_views_api + * Implements hook_views_api(). */ function fieldable_panels_panes_views_api() { return array( @@ -847,6 +846,7 @@ function fieldable_panels_panes_block_info() { if (empty($bundles)) { $ids = db_query('SELECT fpid FROM {fieldable_panels_panes} WHERE reusable = 1')->fetchCol(); } + // Get reusable entities of selected FPP bundles if $bundles array is not // empty. else { @@ -870,6 +870,7 @@ function fieldable_panels_panes_block_info() { */ function fieldable_panels_panes_block_view($delta = '') { $block = array(); + // Get array of exposed FPP bundles. $bundles = fieldable_panels_panes_exposed_bundles(); @@ -887,6 +888,7 @@ function fieldable_panels_panes_block_view($delta = '') { $block['content'] = $content; } } + return $block; } @@ -907,10 +909,10 @@ function fieldable_panels_panes_exposed_bundles() { } // ------------------------------------------------------------------------- -// Theming +// Theming. /** - * Preprocess function for fieldable-panels-pane.tpl.php + * Preprocess function for fieldable-panels-pane.tpl.php. */ function template_preprocess_fieldable_panels_pane(&$vars) { $vars += array('content' => array()); @@ -955,12 +957,12 @@ function fieldable_panels_panes_process_fieldable_panels_pane(&$variables) { } // ------------------------------------------------------------------------- -// Database and general entity API functions +// Database and general entity API functions. /** * Panel pane entity loader. * - * @see entity_load(). + * @see entity_load() */ function fieldable_panels_panes_load($fpid, $vid = NULL) { if (!is_numeric($fpid)) { @@ -980,8 +982,8 @@ function fieldable_panels_panes_load($fpid, $vid = NULL) { * A string combining an indicator of the type of ID, e.g. 'fpid', 'vid' or * 'vuuid', and an integer ID, separated by a colon; e.g. "fpid:123". * - * @return object - * The requested FPP object. + * @return object|bool + * The requested FPP object, FALSE otherwise. */ function fieldable_panels_panes_load_from_subtype($subtype_name) { ctools_include('content'); @@ -990,6 +992,11 @@ function fieldable_panels_panes_load_from_subtype($subtype_name) { // Next, check to see how the subtype is configured. $subtype_info = ctools_content_get_subtype($plugin, $subtype_name); + // If the FPP type doesn't exist then fail. + if (!isset($subtype_info['bundle'])) { + return FALSE; + } + // This means we're probably in the process of creating a new one. if (!isset($subtype_info['entity_id'])) { return fieldable_panels_panes_create(array('bundle' => $subtype_info['bundle'])); @@ -1034,11 +1041,12 @@ function fieldable_panels_panes_load_from_subtype_force($subtype_name) { // UUID integration for revisions. elseif ($type == 'vuuid' && module_exists('uuid')) { - $vids = entity_get_id_by_uuid('fieldable_panels_pane', array($id), TRUE); + $vids = entity_get_id_by_uuid('fieldable_panels_pane', array($id), TRUE); if ($vids && $content = entity_load('fieldable_panels_pane', FALSE, array('vid' => reset($vids)))) { $object = reset($content); } } + // If the type is 'vid' then a specific FPP revision is being requested. elseif ($type == 'vid') { $fpid = db_query('SELECT fpid FROM {fieldable_panels_panes_revision} WHERE vid = :vid', array(':vid' => $id))->fetchField(); @@ -1048,7 +1056,7 @@ function fieldable_panels_panes_load_from_subtype_force($subtype_name) { // Load up the current revision. elseif ($type == 'current') { $vid = db_query('SELECT MAX(vid) FROM {fieldable_panels_panes_revision} WHERE fpid = :fpid', array(':fpid' => $id))->fetchField(); - $object = fieldable_panels_panes_load($id, $vid); + $object = fieldable_panels_panes_load($id, $vid); } // The remaining scenario is that it's a regular FPP id, i.e. an "fpid", so @@ -1063,7 +1071,7 @@ function fieldable_panels_panes_load_from_subtype_force($subtype_name) { /** * Load multiple fieldable panel panes. * - * @see entity_load_multiple(). + * @see entity_load_multiple() */ function fieldable_panels_panes_load_multiple($ids, $conditions = array(), $reset = FALSE) { return entity_load('fieldable_panels_pane', $ids, $conditions, $reset); @@ -1081,7 +1089,7 @@ function fieldable_panels_panes_save($entity) { /** * Delete a fieldable panel pane. * - * @param $fpid + * @param int $fpid * A fieldable panel pane ID. */ function fieldable_panels_panes_delete($fpid) { @@ -1091,10 +1099,13 @@ function fieldable_panels_panes_delete($fpid) { /** * Delete a revision for a fieldable panel pane. * - * @param $fpid + * @param int $fpid * A fieldable panel pane ID. - * @param $vid + * @param int $vid * The revision id to delete. + * + * @return bool + * Indicates whether the object was successfully deleted or not. */ function fieldable_panels_panes_delete_revision($fpid, $vid) { if ($revision = fieldable_panels_panes_load($fpid, $vid)) { @@ -1117,10 +1128,10 @@ function fieldable_panels_panes_delete_revision($fpid, $vid) { /** * Delete multiple fieldable panel panes. * - * @param $fpids + * @param array $fpids * An array of fieldable panel pane IDs. */ -function fieldable_panels_panes_delete_multiple($fpids) { +function fieldable_panels_panes_delete_multiple(array $fpids) { return entity_get_controller('fieldable_panels_pane')->delete($fpids); } @@ -1130,7 +1141,8 @@ function fieldable_panels_panes_delete_multiple($fpids) { * @see node_view() */ function fieldable_panels_panes_view($entity, $view_mode = 'full', $langcode = NULL) { - return entity_get_controller('fieldable_panels_pane')->view($entity, $view_mode, $langcode); + // Defer to the other function. + return fieldable_panels_pane_view($entity, $view_mode, $langcode); } /** @@ -1141,7 +1153,7 @@ function fieldable_panels_panes_view($entity, $view_mode = 'full', $langcode = N * * @see entity_view() */ -function fieldable_panels_pane_view($entity, $view_mode = 'full', $langcode) { +function fieldable_panels_pane_view($entity, $view_mode = 'full', $langcode = NULL) { return entity_get_controller('fieldable_panels_pane')->view($entity, $view_mode, $langcode); } @@ -1199,6 +1211,7 @@ function fieldable_panels_panes_get_base_context($entity = NULL) { } else { $context = ctools_context_create_empty('entity:fieldable_panels_pane'); + // The placeholder is needed to create the form used for the live // preview. $context->placeholder = array( @@ -1233,10 +1246,6 @@ function fieldable_panels_panes_entity_edit_form($form, &$form_state) { ); $form_state['fieldable_panels_pane'] = $form_state['entity']; - // fixes a bug in wysiwyg - // oh wysiwyg. We need a better way to address this. -// drupal_add_css('sites/all/libraries/ckeditor/skins/kama/editor.css'); - $form['title'] = array( '#type' => 'textfield', '#title' => t('Title'), @@ -1278,7 +1287,12 @@ function fieldable_panels_panes_entity_edit_form($form, &$form_state) { $form['link']['path'] = array( '#type' => 'textfield', '#title' => t('Path'), - '#description' => t('The path for this link. This can be an internal Drupal path such as %add-node or an external URL such as %drupal. Enter %front to link to the front page.', array('%front' => '<front>', '%add-node' => 'node/add', '%drupal' => 'http://drupal.org')), + '#description' => t('The path for this link. This can be an internal Drupal path such as %add-node or an external URL such as %drupal. Enter %front to link to the front page.', + array( + '%front' => '<front>', + '%add-node' => 'node/add', + '%drupal' => 'http://drupal.org', + )), '#states' => array( 'visible' => array( ':input[name="link"]' => array('checked' => TRUE), @@ -1472,7 +1486,7 @@ function fieldable_panels_panes_entity_edit_form_submit($form, &$form_state) { $entity->revision = $form_state['values']['revision']; // Only set a log message if there was a new revision. This prevents - // overwriting a log message on the current revision + // overwriting a log message on the current revision. if ($entity->revision) { $entity->log = $form_state['values']['log']; } @@ -1509,11 +1523,10 @@ function fieldable_panels_panes_metadata_fpp_get_properties($entity, array $opti } /** - * Implements hook_form_FORM_ID_alter for ctools_export_ui_edit_item_form. - * - * Minor improvements to the FPP bundle/type form. + * Implements hook_form_FORM_ID_alter() for ctools_export_ui_edit_item_form(). */ function fieldable_panels_panes_form_ctools_export_ui_edit_item_form_alter(&$form, &$form_state, $form_id) { + // Minor improvements to the FPP bundle/type form. if (isset($form_state['plugin']['name']) && $form_state['plugin']['name'] == 'fieldable_panels_pane') { $form['info']['description']['#description'] = t('The administrative description of this type. Also used as the icon tooltip when attempting to add an item of this type via the Panels interface.'); } @@ -1598,6 +1611,7 @@ function fieldable_panels_panes_file_download_access($field, $entity_type, $enti * The FPP object being examined. * * @return bool + * Whether the revision can be locked. */ function fieldable_panels_panes_revision_is_lockable($entity) { $lock = variable_get('fpp_revision_locking', 'lock'); @@ -1644,3 +1658,48 @@ function fieldable_panels_panes_entity_delete($entity, $type) { cache_clear_all($cid, 'cache_panels'); } } + +/** + * Implements hook_panelizer_clone_panelizer(). + */ +function fieldable_panels_panes_panelizer_clone_panelizer(&$panelizer) { + foreach ($panelizer->display->content as $pid => $pane) { + if ($pane->type == "fieldable_panels_pane") { + $entity_info = entity_get_info('fieldable_panels_pane'); + $fpp = fieldable_panels_panes_load_from_subtype_force($pane->subtype); + + // Reusable FPPs do not get cloned. + if ($fpp->reusable) { + continue; + } + + // Clone the FPP and make sure it will get saved as a new entity. + $new_fpp = clone $fpp; + + // Reset the primary keys. + $new_fpp->fpid = NULL; + $new_fpp->vid = NULL; + $new_fpp->vuuid = NULL; + $new_fpp->uuid = NULL; + $new_fpp->is_new = TRUE; + + // Reset timestamps. + $new_fpp->created = NULL; + $new_fpp->timestamp = NULL; + + // Make sure the status of a cloned exportable is custom. + if (!empty($entity_info['exportable'])) { + $status_key = isset($entity_info['entity keys']['status']) ? $entity_info['entity keys']['status'] : 'status'; + // Replaces ENTITY_CUSTOM because we cannot assume that the Entity API + // module is installed. + $new_fpp->$status_key = 0x01; + } + + // Save the new FPP object and add it to the display. + $new_fpp = fieldable_panels_panes_save($new_fpp); + list($subtype_prefix,) = explode(':', $pane->subtype); + $key = $subtype_prefix == 'current' ? 'fpid' : $subtype_prefix; + $pane->subtype = $subtype_prefix . ':' . $new_fpp->{$key}; + } + } +} diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.services.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.services.inc new file mode 100644 index 0000000000000000000000000000000000000000..fcb61b749d198c514e301fa96e09793c608c5f27 --- /dev/null +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.services.inc @@ -0,0 +1,347 @@ +<?php + +/** + * @file + * Contains callbacks for service resource manipulation. + */ + +/** + * Implements hook_services_resources(). + */ +function fieldable_panels_panes_services_resources() { + return array( + 'fieldable_panels_panes' => array( + 'operations' => array( + 'retrieve' => array( + 'help' => t('This method returns a fieldable panels pane.'), + 'callback' => 'fieldable_panels_panes_services_retrieve', + 'file' => array( + 'type' => 'inc', + 'module' => 'fieldable_panels_panes', + 'name' => 'fieldable_panels_panes.services', + ), + 'access callback' => 'fieldable_panels_panes_services_access', + 'access arguments' => array('view'), + 'access arguments append' => TRUE, + 'args' => array( + array( + 'name' => 'fpid', + 'type' => 'int', + 'description' => t('The id of the fieldable panels pane to get.'), + 'source' => array('path' => '0'), + 'optional' => FALSE, + ), + array( + 'name' => 'vid', + 'type' => 'int', + 'description' => t('The vid of the fieldable panels pane to get.'), + 'source' => array('param' => 'vid'), + 'optional' => TRUE, + ), + ), + ), + 'create' => array( + 'help' => t('This method creates a fieldable panels pane.'), + 'callback' => 'fieldable_panels_panes_services_create', + 'file' => array( + 'type' => 'inc', + 'module' => 'fieldable_panels_panes', + 'name' => 'fieldable_panels_panes.services', + ), + 'access callback' => 'fieldable_panels_panes_services_access', + 'access arguments' => array('create'), + 'access arguments append' => TRUE, + 'args' => array( + array( + 'name' => 'data', + 'type' => 'struct', + 'description' => t('An object representing the fieldable panels pane.'), + 'source' => 'data', + 'optional' => FALSE, + ), + ), + ), + 'update' => array( + 'help' => t('This method updates a fieldable panels pane.'), + 'callback' => 'fieldable_panels_panes_services_update', + 'file' => array( + 'type' => 'inc', + 'module' => 'fieldable_panels_panes', + 'name' => 'fieldable_panels_panes.services', + ), + 'access callback' => 'fieldable_panels_panes_services_access', + 'access arguments' => array('update'), + 'access arguments append' => TRUE, + 'args' => array( + array( + 'name' => 'fpid', + 'type' => 'int', + 'description' => t('The id of the fieldable panels pane to update.'), + 'source' => array('path' => '0'), + 'optional' => FALSE, + ), + array( + 'name' => 'data', + 'type' => 'struct', + 'description' => t('An object representing the fieldable panels pane.'), + 'source' => 'data', + 'optional' => FALSE, + ), + ), + ), + 'delete' => array( + 'help' => t('This method deletes a fieldable panels pane.'), + 'callback' => 'fieldable_panels_panes_services_delete', + 'file' => array( + 'type' => 'inc', + 'module' => 'fieldable_panels_panes', + 'name' => 'fieldable_panels_panes.services', + ), + 'access callback' => 'fieldable_panels_panes_services_access', + 'access arguments' => array('delete'), + 'access arguments append' => TRUE, + 'args' => array( + array( + 'name' => 'fpid', + 'type' => 'int', + 'description' => t('The id of the fieldable panels pane to delete.'), + 'source' => array('path' => '0'), + 'optional' => FALSE, + ), + ), + ), + 'index' => array( + 'help' => t('This method returns a listing of fieldable panels panes.'), + 'callback' => 'fieldable_panels_panes_services_index', + 'file' => array( + 'type' => 'inc', + 'module' => 'fieldable_panels_panes', + 'name' => 'fieldable_panels_panes.services', + ), + 'access arguments' => array('administer fieldable panels panes'), + 'args' => array( + array( + 'name' => 'page', + 'optional' => TRUE, + 'type' => 'int', + 'description' => t('The zero-based index of the page to get, defaults to 0.'), + 'default value' => 0, + 'source' => array('param' => 'page'), + ), + array( + 'name' => 'fields', + 'optional' => TRUE, + 'type' => 'string', + 'description' => t('The fields to return.'), + 'default value' => '*', + 'source' => array('param' => 'fields'), + ), + array( + 'name' => 'parameters', + 'optional' => TRUE, + 'type' => 'array', + 'description' => t('Fields an values to filter the list by.'), + 'default value' => array(), + 'source' => array('param' => 'parameters'), + ), + array( + 'name' => 'pagesize', + 'optional' => TRUE, + 'type' => 'int', + 'description' => t('Number of records to get per page.'), + 'default value' => 20, + 'source' => array('param' => 'pagesize'), + ), + array( + 'name' => 'options', + 'optional' => TRUE, + 'type' => 'array', + 'description' => 'Additional query options.', + 'default value' => array( + 'orderby' => array( + 'created' => 'DESC', + ), + ), + 'source' => array('param' => 'options'), + ), + ), + ), + ), + ), + ); +} + +/** + * Access callback for the fieldable panels pane resource. + * + * @param string $op + * The operation that's going to be performed. + * @param array $args + * The arguments that will be passed to the callback. + * + * @return bool + * Whether access is given or not. + */ +function fieldable_panels_panes_services_access($op, array $args) { + // Make sure we have an object or this all fails, some servers can + // mess up the types. + if (is_array($args[0])) { + $args[0] = (object) $args[0]; + } + // This is to determine if it is just a string happens on node/%NID. + elseif (!is_array($args[0]) && !is_object($args[0])) { + $args[0] = (object) array('fpid' => $args[0]); + } + + if ($op != 'create' && !empty($args)) { + $fpp = fieldable_panels_panes_load($args[0]->fpid); + } + elseif ($op == 'create') { + if (isset($args[0]->bundle)) { + $fpp = $args[0]->bundle; + return fieldable_panels_panes_access($op, $fpp); + } + else { + return services_error(t('Fieldable panels pane bundle is required'), 406); + } + } + if (isset($fpp->fpid) && $fpp->fpid) { + return fieldable_panels_panes_access($op, $fpp); + } + else { + return services_error(t('Fieldable panel pane @fpid could not be found', array('@fpid' => $args[0]->fpid)), 404); + } +} + +/** + * Returns a specified fieldable panels pane. + * + * @param int $fpid + * The Fieldable Panels Pane ID. + * @param int $vid + * The Fieldable Panels Pane VID. + * + * @return bool|mixed + * Fieldable Panel Pane Entity. + */ +function fieldable_panels_panes_services_retrieve($fpid, $vid = NULL) { + return fieldable_panels_panes_load($fpid, $vid); +} + +/** + * Adds a new Fieldable Panels Pane and return the fpid. + * + * @param array $fpp + * The data to create the fieldable panels pane with. + * + * @return int|mixed + * Returns the ID of the Fieldable Panels Pane or errors. + */ +function fieldable_panels_panes_services_create(array $fpp) { + $fpp_new = fieldable_panels_panes_create($fpp); + + $form_state = array(); + $form_state['values'] = $fpp; + $form_state['entity'] = $fpp_new; + + drupal_form_submit('fieldable_panels_panes_entity_edit_form', $form_state); + + if ($errors = form_get_errors()) { + return services_error(implode(" ", $errors), 406, array('form_errors' => $errors)); + } + + $fpp = $form_state['entity']; + + return array( + 'fpid' => $fpp->fpid, + 'uri' => services_resource_uri(array('fieldable_panels_pane', $fpp->fpid)), + ); +} + +/** + * Updates a Fieldable Panels Pane. + * + * @param int $fpid + * The Fieldable Panels Pane ID. + * @param array $fpp + * Fieldable Panels Pane. + * + * @return int|mixed + * Unique identifier for the Fieldable Panels Pane or FALSE if there was a + * problem. + */ +function fieldable_panels_panes_services_update($fpid, array $fpp) { + $fpp['pfid'] = $fpid; + + $old_fpp = fieldable_panels_panes_load($fpid); + if (empty($old_fpp)) { + return services_error(t('Fieldable Panels Pane @fpid not found.', array('@fpid' => $fpid)), 404); + } + + // Setup form_state. + $form_state = array(); + $form_state['values'] = $fpp; + $form_state['entity'] = $old_fpp; + + drupal_form_submit('fieldable_panels_panes_entity_edit_form', $form_state); + + if ($errors = form_get_errors()) { + return services_error(implode(" ", $errors), 406, array('form_errors' => $errors)); + } + + return $fpid; +} + +/** + * Delete a fieldable panels pane. + * + * @param int $fpid + * Unique identifier of the fieldable panels pane to delete. + * + * @return bool|mixed + * TRUE if deleted successfully, or services_error(). + */ +function fieldable_panels_panes_services_delete($fpid) { + $fpp = fieldable_panels_panes_load($fpid); + if (empty($fpp)) { + return services_error(t('There is no fieldable panels pane found with id @fpid.', array('@fpid' => $fpid)), 404); + } + + // Delete fieldable panels pane. + fieldable_panels_panes_delete($fpid); + + return TRUE; +} + +/** + * Return an array of optionally paged bids based on a set of criteria. + * + * An example request might look like: + * + * http://domain/endpoint/fieldable_panels_panes?fields=fpid,label¶meters[bundle]=text + * + * This would return an array of objects with only pfid and label defined, where + * bundle = 'text'. + * + * @param int $page + * Page number of results to return (in pages of 20). + * @param string $fields + * The fields you want returned as a string separated by commas. + * @param array $parameters + * Fields and values used to build a sql WHERE clause indicating items to + * retrieve. + * @param int $page_size + * Integer number of items to be returned. + * + * @return array + * An array of fieldable_panels_pane objects. + */ +function fieldable_panels_panes_services_index($page, $fields, array $parameters, $page_size, $options = array()) { + $fpp_select = db_select('fieldable_panels_panes', 't')->orderBy('bundle', 'ASC'); + + services_resource_build_index_query($fpp_select, $page, $fields, $parameters, $page_size, 'fieldable_panels_pane', $options); + + $results = services_resource_execute_index_query($fpp_select); + + return services_resource_build_index_list($results, 'fieldable_panels_pane', 'fpid'); +} diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.vertical-tabs.js b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.vertical-tabs.js index 36203d5011607d821ea705ac195f47b11156cb7a..53fb3400fe62ed5057ae5401e3ed6b706b5e956b 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.vertical-tabs.js +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/fieldable_panels_panes.vertical-tabs.js @@ -1,41 +1,48 @@ -(function ($) { +/** + * @file + * Custom JS for vertical tab handling on FPPs. + */ -Drupal.behaviors.fieldablePanelPaneFieldsetSummaries = { - attach: function (context) { - $('fieldset.vertical-tabs-pane.fieldable-pane-pane-form-reusable-information', context).drupalSetSummary(function (context) { - var summary = []; - - if ($('input[name="reusable"]', context).is(':checked')) { - summary.push(Drupal.t('Reusable: Yes')); - var category = $('input[name="category"]', context).val() || Drupal.t('None'); - summary.push(Drupal.t('Category: @value', { '@value': category })); - } - else { - summary.push(Drupal.t('Reusable: No')); - } - - return summary.join('<br />'); - }); - - $('fieldset.vertical-tabs-pane.fieldable-pane-pane-form-admin-information', context).drupalSetSummary(function (context) { - var admin_title = $('input[name="admin_title"]', context).val() || Drupal.t('None'); - return Drupal.t('Admin title: @value', { '@value': admin_title }); - }); - - $('fieldset.vertical-tabs-pane.fieldable-pane-pane-form-revision-information', context).drupalSetSummary(function (context) { - var revisionCheckbox = $('input[name="revision"]', context); - - // Return 'New revision' if the 'Create new revision' checkbox is checked, - // or if the checkbox doesn't exist, but the revision log does. For users - // without the "Administer content" permission the checkbox won't appear, - // but the revision log will if the content type is set to auto-revision. - if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $('.form-item-log textarea', context).length)) { - return Drupal.t('New revision'); - } - - return Drupal.t('No revision'); - }); - } -}; +(function ($) { + 'use strict'; + + Drupal.behaviors.fieldablePanelPaneFieldsetSummaries = { + attach: function (context) { + $('fieldset.vertical-tabs-pane.fieldable-pane-pane-form-reusable-information', context).drupalSetSummary(function (context) { + var summary = []; + + if ($('input[name="reusable"]', context).is(':checked')) { + summary.push(Drupal.t('Reusable: Yes')); + var category = $('input[name="category"]', context).val() || Drupal.t('None'); + summary.push(Drupal.t('Category: @value', { '@value': category })); + } + else { + summary.push(Drupal.t('Reusable: No')); + } + + return summary.join('<br />'); + }); + + $('fieldset.vertical-tabs-pane.fieldable-pane-pane-form-admin-information', context).drupalSetSummary(function (context) { + var admin_title = $('input[name="admin_title"]', context).val() || Drupal.t('None'); + return Drupal.t('Admin title: @value', { '@value': admin_title }); + }); + + $('fieldset.vertical-tabs-pane.fieldable-pane-pane-form-revision-information', context).drupalSetSummary(function (context) { + var revisionCheckbox = $('input[name="revision"]', context); + + // Return 'New revision' if the 'Create new revision' checkbox is + // checked, or if the checkbox doesn't exist, but the revision log + // does. For users without the "Administer content" permission the + // checkbox won't appear, but the revision log will if the content type + // is set to auto-revision. + if (revisionCheckbox.is(':checked') || (!revisionCheckbox.length && $('.form-item-log textarea', context).length)) { + return Drupal.t('New revision'); + } + + return Drupal.t('No revision'); + }); + } + }; })(jQuery); diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/FieldablePanelsPaneInlineEntityFormController.class.php b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/FieldablePanelsPaneInlineEntityFormController.class.php index 421271628ff530af3abd13c203baeecfc3006708..441c531781aec420c58327273231a80799901ef7 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/FieldablePanelsPaneInlineEntityFormController.class.php +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/FieldablePanelsPaneInlineEntityFormController.class.php @@ -5,10 +5,13 @@ * Defines the inline entity form controller for Nodes. */ +/** + * Support for Inline Entity Form. + */ class FieldablePanelsPaneInlineEntityFormController extends EntityInlineEntityFormController { /** - * Overrides EntityInlineEntityFormController::defaultLabels(). + * {@inheritdoc} */ public function defaultLabels() { $labels = array( @@ -19,7 +22,7 @@ class FieldablePanelsPaneInlineEntityFormController extends EntityInlineEntityFo } /** - * Overrides EntityInlineEntityFormController::tableFields(). + * {@inheritdoc} */ public function tableFields($bundles) { $fields = parent::tableFields($bundles); @@ -28,11 +31,10 @@ class FieldablePanelsPaneInlineEntityFormController extends EntityInlineEntityFo } /** - * Overrides EntityInlineEntityFormController::entityForm(). - * - * Copied from fieldable_panels_panes_entity_edit_form(). + * {@inheritdoc} */ public function entityForm($entity_form, &$form_state) { + // Copied from fieldable_panels_panes_entity_edit_form(). // Make the other form items dependent upon it. ctools_include('dependent'); ctools_add_js('dependent'); @@ -158,12 +160,11 @@ class FieldablePanelsPaneInlineEntityFormController extends EntityInlineEntityFo } /** - * Overrides EntityInlineEntityFormController::entityFormSubmit(). - * - * Fixes some of the custom entity values, similar to - * fieldable_panels_panes_entity_edit_form_submit(). + * {@inheritdoc} */ public function entityFormSubmit(&$entity_form, &$form_state) { + // Fixes some of the custom entity values, similar to + // fieldable_panels_panes_entity_edit_form_submit(). $info = entity_get_info($this->entityType); list(, , $bundle) = entity_extract_ids($this->entityType, $entity_form['#entity']); $entity = $entity_form['#entity']; @@ -216,4 +217,5 @@ class FieldablePanelsPaneInlineEntityFormController extends EntityInlineEntityFo field_attach_submit($this->entityType, $entity, $entity_form, $form_state); } } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/PanelsPaneController.class.php b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/PanelsPaneController.class.php index e1c034ac2560fa59a8283c20c8840cb255c7d7b5..29452782254517370a4b764102ad5d16559e75fc 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/PanelsPaneController.class.php +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/PanelsPaneController.class.php @@ -1,7 +1,7 @@ <?php + /** * @file - * * Contains the controller class for the Fieldable Panel Pane entity. */ @@ -9,10 +9,16 @@ * Entity controller class. */ class PanelsPaneController extends DrupalDefaultEntityController { + + /** + * The FPP object being processed. + * + * @var object + */ public $entity; /** - * Overrides DrupalDefaultEntityController::resetCache(). + * {@inheritdoc} */ public function resetCache(array $ids = NULL) { if (module_exists('entitycache')) { @@ -22,7 +28,7 @@ class PanelsPaneController extends DrupalDefaultEntityController { } /** - * Overrides DrupalDefaultEntityController::load(). + * {@inheritdoc} */ public function load($ids = array(), $conditions = array()) { if (module_exists('entitycache')) { @@ -34,7 +40,7 @@ class PanelsPaneController extends DrupalDefaultEntityController { } /** - * Overrides DrupalDefaultEntityController::attachLoad(). + * {@inheritdoc} */ public function attachLoad(&$queried_entities, $revision_id = FALSE) { parent::attachLoad($queried_entities, $revision_id); @@ -51,6 +57,9 @@ class PanelsPaneController extends DrupalDefaultEntityController { } } + /** + * {@inheritdoc} + */ public function buildQuery($ids, $conditions = array(), $revision_id = FALSE) { // Add an alias to this query to ensure that we can tell if this is // the current revision or not. @@ -60,6 +69,19 @@ class PanelsPaneController extends DrupalDefaultEntityController { return $query; } + /** + * Custom method to check access to an FPP object for an operation. + * + * @param string $op + * The operation to be performed. + * @param object|null $entity + * The FPP entity to check. + * @param object $account + * The user entity to check. + * + * @return bool + * Whether the user is allowed to perform the requested operation. + */ public function access($op, $entity = NULL, $account = NULL) { if ($op !== 'create' && empty($entity)) { return FALSE; @@ -70,7 +92,8 @@ class PanelsPaneController extends DrupalDefaultEntityController { return TRUE; } - // On the first FALSE we return, otherwise we use our own access check. + // Trigger hook_fieldable_panels_panes_access(). + // On the first FALSE it will return, otherwise use custom checks below. foreach (module_invoke_all('fieldable_panels_panes_access', $op, $entity, $account) as $result) { if ($result === FALSE) { return $result; @@ -98,9 +121,20 @@ class PanelsPaneController extends DrupalDefaultEntityController { return FALSE; } + /** + * Save the given FPP object. + * + * @param object $entity + * An FPP object to save. + * + * @return object|bool + * If the save operation completed correctly, this will be the updated FPP + * object, otherwise it will return FALSE and an exception will be logged in + * watchdog. + */ public function save($entity) { $entity = (object) $entity; - // Determine if we will be inserting a new entity. + // Determine if we will be inserting a new entity. $entity->is_new = !(isset($entity->fpid) && is_numeric($entity->fpid)); $transaction = db_transaction(); @@ -191,15 +225,12 @@ class PanelsPaneController extends DrupalDefaultEntityController { /** * Saves an entity revision with the uid of the current user. * - * @param $entity + * @param object $entity * The fully loaded entity object. - * @param $uid + * @param int|null $uid * The user's uid for the current revision. - * @param $update - * TRUE or FALSE indicating whether or not the existing revision should be - * updated instead of a new one created. */ - function saveRevision($entity, $uid = NULL) { + public function saveRevision($entity, array $uid = NULL) { if (!isset($uid)) { $uid = $GLOBALS['user']->uid; } @@ -221,6 +252,21 @@ class PanelsPaneController extends DrupalDefaultEntityController { } } + /** + * Display a given FPP object. + * + * @param object $entity + * The FPP object to be displayed. + * @param string $view_mode + * The view mode to use; defaults to 'full', i.e. the normal "full content" + * display. + * @param string $langcode + * The language code to use for this; defaults to the current content + * language code. + * + * @return array + * A render array. + */ public function view($entity, $view_mode = 'full', $langcode = NULL) { if (!isset($langcode)) { $langcode = $GLOBALS['language_content']->language; @@ -263,7 +309,7 @@ class PanelsPaneController extends DrupalDefaultEntityController { * Builds a structured array representing the fieldable panel pane's content. * * @param object $entity - * A fieldable panel pane entity. + * A Fieldable Panels Pane entity. * @param string $view_mode * View mode, e.g. 'full', 'teaser'... * @param string $langcode @@ -318,7 +364,13 @@ class PanelsPaneController extends DrupalDefaultEntityController { $entity->content += array('#view_mode' => $view_mode); } - public function delete($fpids) { + /** + * Delete a list of FPPs. + * + * @param array $fpids + * A list of FPP primary keys. + */ + public function delete(array $fpids) { $transaction = db_transaction(); if (!empty($fpids)) { $entities = fieldable_panels_panes_load_multiple($fpids, array()); @@ -355,7 +407,17 @@ class PanelsPaneController extends DrupalDefaultEntityController { } } - public function create($values) { + /** + * Create a barebones FPP object. + * + * @para array $values + * A list of values to add to the base object; must contain the key 'bundle' + * containing the machine name of the FPP bundle/type to be used. + * + * @return object + * An empty object with the expected base fields present. + */ + public function create(array $values) { $entity = (object) array( 'bundle' => $values['bundle'], 'language' => LANGUAGE_NONE, @@ -383,4 +445,5 @@ class PanelsPaneController extends DrupalDefaultEntityController { return $entity; } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/admin.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/admin.inc index 7986502c663bed4585bb26d4ffb04c4ec4f2bea4..ef8f92cdd425b3e3c060821d62bcb3d6fb4b6122 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/admin.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/admin.inc @@ -33,7 +33,7 @@ function fieldable_panels_panes_settings() { $form['fpp_blocks_expose'] = array( '#type' => 'checkbox', '#title' => t('Make fieldable panels panes available as blocks'), - '#description' => t('Fieldable panels panes that are reusable will be made available as blocks.'), + '#description' => t('Fieldable Panels Panes that are reusable will be made available as blocks.'), '#default_value' => variable_get('fpp_blocks_expose', FALSE), ); @@ -82,6 +82,9 @@ function fieldable_panels_panes_settings() { /** * List all entities for the given type. + * + * @param string $type + * The FPP type to process. */ function fieldable_panels_panes_entities_list_page($type) { return views_embed_view('fieldable_pane_entities', 'default', $type); @@ -89,6 +92,9 @@ function fieldable_panels_panes_entities_list_page($type) { /** * Page callback to add a new pane entity. + * + * @param string $type + * The FPP type to process. */ function fieldable_panels_panes_entities_add_page($type) { $form_state = array( @@ -107,6 +113,9 @@ function fieldable_panels_panes_entities_add_page($type) { * This represents an administrative view only. It is not available to * the general public. These entities are meant to be viewed as panel * panes (or blocks). + * + * @param object $entity + * The FPP object to process. */ function fieldable_panels_panes_entity_view_page($entity) { return fieldable_panels_panes_view($entity, 'preview'); @@ -114,6 +123,9 @@ function fieldable_panels_panes_entity_view_page($entity) { /** * Page callback to view a entity. + * + * @param object $entity + * The FPP object to process. */ function fieldable_panels_panes_entity_edit_page($entity) { $form_state = array( @@ -125,21 +137,21 @@ function fieldable_panels_panes_entity_edit_page($entity) { } /** - * Menu callback -- ask for confirmation of node deletion + * Menu callback -- ask for confirmation of node deletion. */ function fieldable_panels_panes_entity_delete_form($form, &$form_state, $entity) { $form_state['entity'] = $entity; return confirm_form($form, t('Are you sure you want to delete %title?', array('%title' => $entity->title)), 'admin/structure/fieldable-panels-panes/view/' . $entity->fpid, - t('This action cannot be undone. Note that deleting this entity will not delete panes using it, they will exist but display nothing.'), + t('This action cannot be undone. Note that deleting this entity will not delete panes using it, they will exist but will display nothing.'), t('Delete'), t('Cancel') ); } /** - * Execute node deletion + * Execute node deletion. */ function fieldable_panels_panes_entity_delete_form_submit($form, &$form_state) { if ($form_state['values']['confirm']) { @@ -153,7 +165,7 @@ function fieldable_panels_panes_entity_delete_form_submit($form, &$form_state) { } /** - * Menu callback -- ask for confirmation of revision deletion + * Menu callback -- ask for confirmation of revision deletion. */ function fieldable_panels_panes_entity_delete_revision_form($form, &$form_state, $entity) { $form_state['entity'] = $entity; @@ -167,7 +179,7 @@ function fieldable_panels_panes_entity_delete_revision_form($form, &$form_state, } /** - * Execute revision deletion + * Execute revision deletion. */ function fieldable_panels_panes_entity_delete_revision_form_submit($form, &$form_state) { if ($form_state['values']['confirm']) { @@ -187,15 +199,14 @@ function fieldable_panels_panes_entity_delete_revision_form_submit($form, &$form /** * Page callback to edit access control of an entity pane. * - * @param $op + * @param string $op * Either 'edit' or 'view' to determine which type of access. - * @param $entity + * @param object $entity * The entity to control access to. */ function fieldable_panels_panes_entity_edit_access_page($op, $entity) { ctools_include('context-access-admin'); // @todo -- add view_access field. - $argument = $op . ':' . $entity->fpid; ctools_include('object-cache'); @@ -238,6 +249,12 @@ function fieldable_panels_panes_entity_edit_access_page($op, $entity) { /** * List all entities for the given type. + * + * @param object $entity + * The FPP object to process. + * + * @return array + * Render array. */ function fieldable_panels_panes_entity_list_revisions_page($entity) { return views_embed_view('fieldable_pane_entity_revisions', 'default', $entity->fpid); @@ -251,6 +268,9 @@ function fieldable_panels_panes_entity_list_revisions_page($entity) { * the entity. * * It is token protected. + * + * @param object $entity + * The FPP object to process. */ function fieldable_panels_panes_entity_make_current_page($entity) { if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], $entity->fpid . ':' . $entity->vid)) { diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/fieldable_panels_pane.migrate.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/fieldable_panels_pane.migrate.inc index 57052bcd93b03614ca2ff29623cc22f606d7c6d4..e8862b2f03b96d87801602d6b93758ec108faefd 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/fieldable_panels_pane.migrate.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/fieldable_panels_pane.migrate.inc @@ -1,19 +1,24 @@ <?php + /** * @file * Support for fieldable_panels_pane destinations. * * Based on MigrateDestinationNode in migrate module * (migrate/plugins/destinations/node.inc). + * + * @todo Make sure this works with updates, explicit destination keys. */ -// @todo Make sure this works with updates, explicit destination keys. /** * Destination class implementing migration into fieldable panels panes. */ class MigrateDestinationFieldablePanelsPanes extends MigrateDestinationEntity { - static public function getKeySchema() { + /** + * {@inheritdoc} + */ + public static function getKeySchema() { return array( 'fpid' => array( 'type' => 'int', @@ -33,34 +38,28 @@ class MigrateDestinationFieldablePanelsPanes extends MigrateDestinationEntity { * Default text format for fieldable panels panes created via this * destination class. */ - static public function options($language, $text_format) { + public static function options($language, $text_format) { return compact('language', 'text_format'); } /** - * Basic initialization. - * - * @param string $bundle - * A.k.a. the fieldable panels pane type (the default fieldable_panels_pane, - * etc.) of the fieldable panels pane. - * @param array $options - * Options applied to fieldable panels panes. + * {@inheritdoc} */ public function __construct($bundle, array $options = array()) { parent::__construct('fieldable_panels_pane', $bundle, $options); } /** - * Returns a list of fields available to be mapped for the fieldable panels - * pane type (bundle). + * Returns a list of fields available to be mapped for the FPP type (bundle). * * @param Migration $migration * Optionally, the migration containing this destination. + * * @return array * Keys: machine names of the fields (to be passed to addFieldMapping) * Values: Human-friendly descriptions of the fields. */ - public function fields($migration = NULL) { + public function fields(Migration $migration = NULL) { $fields = array(); // First the core (fieldable_panels_panes table) properties. $fields['fpid'] = t('The primary identifier for the entity.'); @@ -90,7 +89,7 @@ class MigrateDestinationFieldablePanelsPanes extends MigrateDestinationEntity { /** * Delete a batch of fieldable panels panes at once. * - * @param $fpids + * @param array $fpids * Array of fieldable panels pane IDs to be deleted. */ public function bulkRollback(array $fpids) { @@ -104,11 +103,12 @@ class MigrateDestinationFieldablePanelsPanes extends MigrateDestinationEntity { /** * Import a single fieldable panels pane. * - * @param $fieldable_panels_pane + * @param object $fieldable_panels_pane * Fieldable panels pane object to build. Prefilled with any fields mapped * in the Migration. - * @param $row + * @param object $row * Raw source data object - passed through to prepare/complete handlers. + * * @return array * Array of key fields (fpid only in this case) of the fieldable panels pane * that was saved if successful. FALSE on failure. @@ -228,15 +228,15 @@ class MigrateDestinationFieldablePanelsPanes extends MigrateDestinationEntity { // the changed timestamp. if (isset($changed)) { db_update('fieldable_panels_panes') - ->fields(array('changed' => $changed)) - ->condition('fpid', $fieldable_panels_pane->fpid) - ->execute(); + ->fields(array('changed' => $changed)) + ->condition('fpid', $fieldable_panels_pane->fpid) + ->execute(); $fieldable_panels_pane->changed = $changed; } // Potentially fix timestamp in fieldable_panels_panes_revision. $query = db_update('fieldable_panels_panes_revision') - ->condition('vid', $fieldable_panels_pane->vid); + ->condition('vid', $fieldable_panels_pane->vid); if (isset($changed)) { $fields['timestamp'] = $changed; } @@ -257,6 +257,7 @@ class MigrateDestinationFieldablePanelsPanes extends MigrateDestinationEntity { $this->complete($fieldable_panels_pane, $row); return $return; } + } /** @@ -266,6 +267,8 @@ class DrupalFieldablePanelsPanesMigration extends DrupalMigration { /** * The source and destination content types (bundles) we're dealing with. + * + * @var string */ protected $destinationType; @@ -365,17 +368,6 @@ class DrupalFieldablePanelsPanesMigration extends DrupalMigration { else { $default_uid = 1; } - /* - if (isset($user_migration)) { - $this->addFieldMapping('uid', 'uid') - ->sourceMigration($user_migration) - ->defaultValue($default_uid); - } - else { - $this->addFieldMapping('uid', NULL, FALSE) - ->defaultValue($default_uid); - } - */ } /** @@ -427,7 +419,7 @@ class DrupalFieldablePanelsPanesMigration extends DrupalMigration { } /** - * Implementation of Migration::createStub(). + * {@inheritdoc} */ protected function createStub($migration) { migrate_instrument_start('DrupalNodeMigration::createStub'); diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/translation.handler.fieldable_panels_pane.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/translation.handler.fieldable_panels_pane.inc index 20a213f057ce5513127fa3e2ccd82b9355097f37..ca5bfdb09881dcbf035fb49911cc2451044dd39c 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/translation.handler.fieldable_panels_pane.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/includes/translation.handler.fieldable_panels_pane.inc @@ -5,25 +5,27 @@ * Fieldable panels pane translation handler for the translation module. */ - /** * Fieldable panels pane translation handler. */ class EntityTranslationFieldablePanelsPaneHandler extends EntityTranslationDefaultHandler { + /** + * {@inheritdoc} + */ public function __construct($entity_type, $entity_info, $entity) { parent::__construct('fieldable_panels_pane', $entity_info, $entity); } /** - * @see EntityTranslationDefaultHandler::isRevision() + * {@inheritdoc} */ public function isRevision() { return !empty($this->entity->revision); } /** - * @see EntityTranslationDefaultHandler::getAccess() + * {@inheritdoc} */ public function getAccess($op) { return fieldable_panels_panes_access($op, $this->entity); @@ -46,4 +48,5 @@ class EntityTranslationFieldablePanelsPaneHandler extends EntityTranslationDefau ); } } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/content_types/fieldable_panels_pane.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/content_types/fieldable_panels_pane.inc index 174f290536cc247db6195f6781be121b75b0bda1..fc1c37aa3a748d0f52e84db28edd4fa32b0db466 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/content_types/fieldable_panels_pane.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/content_types/fieldable_panels_pane.inc @@ -2,16 +2,15 @@ /** * @file - * * CTools content type to render a fielded panel pane. */ /** * Small hook implementation of plugin. * - * We have to use this because the form here can be loaded via form - * caching and if this .inc file is loaded before the plugin is - * requested, the $plugin = array() notation doesn't work. + * We have to use this because the form here can be loaded via form caching and + * if this .inc file is loaded before the plugin is requested, the $plugin = + * array() notation doesn't work. */ function fieldable_panels_panes_fieldable_panels_pane_ctools_content_types() { return array( @@ -32,9 +31,10 @@ function fieldable_panels_panes_fieldable_panels_pane_ctools_content_types() { // Form API callback. 'edit form' => 'fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form', // Access callback. - 'check editable' => 'fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form_access', + 'check editable' => 'fieldable_panels_pane_content_type_edit_form_access', ); } + // -------------------------------------------------------------------------- // Callbacks, many of them automatically named, for rendering content. @@ -62,7 +62,7 @@ function fieldable_panels_panes_fieldable_panels_pane_content_type($subtype_id, } } - // If nothing was loaded yet, + // If nothing was loaded yet. if (empty($content_type)) { $type = 'fieldable_panels_pane'; $subtypes = ctools_content_get_subtypes($type); @@ -76,6 +76,9 @@ function fieldable_panels_panes_fieldable_panels_pane_content_type($subtype_id, } } + // Trigger hook_fieldable_panels_pane_content_type_alter(). + drupal_alter('fieldable_panels_pane_content_type', $content_type, $subtype_id, $plugin); + return $content_type; } @@ -122,15 +125,15 @@ function fieldable_panels_panes_fieldable_panels_pane_content_type_content_types /** * Returns a list of all reusable FPP entities of a given bundle. * - * @param $bundle + * @param string $bundle * Fieldable panel pane bundle machine name. - * @param $ids + * @param array $ids * An array of fieldable panel pane entity ids. * * @return array * An array of content type information for each fpp entity. */ -function fieldable_panels_panes_build_content_type_info($bundle, $ids) { +function fieldable_panels_panes_build_content_type_info($bundle, array $ids) { $types = array(); $cid = "fieldable_panels_panes_{$bundle}_content_type"; @@ -162,7 +165,7 @@ function fieldable_panels_panes_build_content_type_info($bundle, $ids) { /** * Callback to render our content type. */ -function fieldable_panels_panes_fieldable_panels_pane_content_type_render($subtype, $conf, $panel_args = array(), $context = array()) { +function fieldable_panels_panes_fieldable_panels_pane_content_type_render($subtype, $conf, array $panel_args = array(), array $context = array()) { $entity = fieldable_panels_panes_load_from_subtype($subtype); if (!empty($entity) && !empty($entity->fpid) && fieldable_panels_panes_access('view', $entity)) { $view_mode = isset($conf['view_mode']) ? $conf['view_mode'] : 'full'; @@ -188,7 +191,7 @@ function fieldable_panels_panes_fieldable_panels_pane_content_type_render($subty // Combine all of the above logic. if (empty($settings['extra_fields']['display']) || (!$is_view_mode_set && $show_default_title) - || !$show_view_mode_title) { + || $show_view_mode_title) { $block->title = filter_xss_admin($entity->title); } } @@ -367,8 +370,13 @@ function fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form_sub /** * Callback for the 'edit' permission. */ -function fieldable_panels_panes_fieldable_panels_pane_content_type_edit_form_access($content_type, $subtype, $view_mode = 'full') { - return fieldable_panels_panes_check_access_update($subtype); +function fieldable_panels_pane_content_type_edit_form_access($content_type, $subtype, $view_mode = 'full') { + $return = fieldable_panels_panes_check_access_update($subtype); + + // Trigger hook_fieldable_panels_pane_content_type_edit_form_access_alter(). + drupal_alter('fieldable_panels_pane_content_type_edit_form_access', $return, $content_type, $subtype, $view_mode); + + return $return; } // -------------------------------------------------------------------------- diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/entity/FieldablePanelsPaneEntity.class.php b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/entity/FieldablePanelsPaneEntity.class.php index 75711174a853f0691fb33305fc3660a0633f99dd..b50e0c2f129341319241326b163047ed6240ac97 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/entity/FieldablePanelsPaneEntity.class.php +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/entity/FieldablePanelsPaneEntity.class.php @@ -1,4 +1,5 @@ <?php + /** * @file * Class for the Panelizer fieldable_panels_pane term entity plugin. @@ -10,31 +11,60 @@ * Handles term specific functionality for Panelizer. */ class FieldablePanelsPaneEntity extends PanelizerEntityDefault { + + /** + * {@inheritdoc} + */ public $entity_admin_root = 'admin/structure/fieldable-panels-panes/%fieldable_panels_pane_type'; + + /** + * {@inheritdoc} + */ public $entity_admin_bundle = 3; + + /** + * {@inheritdoc} + */ public $supports_revisions = TRUE; + + /** + * {@inheritdoc} + */ public $views_table = 'fieldable_panels_panes'; + /** + * {@inheritdoc} + */ public function entity_access($op, $entity) { return fieldable_panels_panes_access($op, $entity); } /** - * Implement the save function for the entity. + * {@inheritdoc} */ public function entity_save($entity) { return fieldable_panels_panes_save($entity); } + /** + * {@inheritdoc} + */ public function entity_identifier($entity) { return t('This pane'); } + /** + * {@inheritdoc} + */ public function entity_bundle_label() { return t('Pane bundle'); } - function get_default_display($bundle, $view_mode) { + /** + * {@inheritdoc} + */ + public function get_default_display($bundle, $view_mode) { return parent::get_default_display($bundle, $view_mode); } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/entity/fieldable_panels_pane.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/entity/fieldable_panels_pane.inc index 564a776bbe1f18c3d1fcfe4a7d09f995d1fddc63..8d7a40e15f1b926090f486a0497ee7102ce091f4 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/entity/fieldable_panels_pane.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/entity/fieldable_panels_pane.inc @@ -1,8 +1,10 @@ <?php + /** * @file * Definition of the taxonomy term plugin. */ + $plugin = array( 'handler' => 'FieldablePanelsPaneEntity', 'entity path' => 'admin/structure/fieldable-panels-panes/view/%fieldable_panels_panes', diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/export_ui/fieldable_panels_pane.class.php b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/export_ui/fieldable_panels_pane.class.php index b7b1ec0e440ec022c1bb9fd3c7c9aa54af307b30..bc11e0b7ef25e989bc65f4f989ac8b3f0fc5fc74 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/export_ui/fieldable_panels_pane.class.php +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/export_ui/fieldable_panels_pane.class.php @@ -13,7 +13,7 @@ class fieldable_panels_pane extends ctools_export_ui { /** * Add some additional operations for handling entities. */ - function build_operations($item) { + public function build_operations($item) { $base_path = ctools_export_ui_plugin_base_path($this->plugin); $name = $item->{$this->plugin['export']['key']}; @@ -58,11 +58,12 @@ class fieldable_panels_pane extends ctools_export_ui { } /** - * Allow users to jump right into adding fields. + * {@inheritdoc} */ - function edit_form(&$form, &$form_state) { + public function edit_form(&$form, &$form_state) { parent::edit_form($form, $form_state); + // Allow users to jump right into adding fields. if (module_exists('field_ui')) { $form['buttons']['save_continue'] = array( '#type' => 'submit', @@ -73,22 +74,24 @@ class fieldable_panels_pane extends ctools_export_ui { } /** - * Update the form state "op" so we can properly redirect. + * {@inheritdoc} */ - function edit_form_submit(&$form, &$form_state) { + public function edit_form_submit(&$form, &$form_state) { parent::edit_form_submit($form, $form_state); + // Update the form state "op" so we can properly redirect. if ($form_state['triggering_element']['#parents'][0] == 'save_continue') { $form_state['op'] = 'save_continue'; } } /** - * Ensure menu gets rebuild after saving a new type. + * {@inheritdoc} */ - function edit_save_form($form_state) { + public function edit_save_form($form_state) { parent::edit_save_form($form_state); + // Ensure menu gets rebuild after saving a new type. entity_info_cache_clear(); menu_rebuild(); @@ -98,11 +101,12 @@ class fieldable_panels_pane extends ctools_export_ui { } /** - * Remove fields associated to bundles that are being deleted. + * {@inheritdoc} */ - function delete_form_submit(&$form_state) { + public function delete_form_submit(&$form_state) { parent::delete_form_submit($form_state); + // Remove fields associated to bundles that are being deleted. if ($form_state['op'] == 'delete') { field_attach_delete_bundle('fieldable_panels_pane', $form_state['item']->name); entity_info_cache_clear(); @@ -112,7 +116,7 @@ class fieldable_panels_pane extends ctools_export_ui { /** * List entities page. */ - function list_entities_page($js, $input, $item, $step = NULL) { + public function list_entities_page($js, $input, $item, $step = NULL) { drupal_set_title($this->get_page_title('list_entity', $item)); return views_embed_view('fieldable_pane_entities', 'default', $item->name); @@ -121,7 +125,7 @@ class fieldable_panels_pane extends ctools_export_ui { /** * Add entity page. */ - function add_entity_page($js, $input, $item, $step = NULL) { + public function add_entity_page($js, $input, $item, $step = NULL) { drupal_set_title($this->get_page_title('add_entity', $item)); $form_state = array( @@ -151,7 +155,7 @@ class fieldable_panels_pane extends ctools_export_ui { /** * List footer. */ - function list_footer($form_state) { + public function list_footer($form_state) { ctools_include('export'); $items = ctools_export_crud_load_all('fieldable_panels_pane_type'); $entity_info = entity_get_info('fieldable_panels_pane'); @@ -210,7 +214,10 @@ class fieldable_panels_pane extends ctools_export_ui { } } - $ops = theme('links', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline')))); + $ops = theme('links', array( + 'links' => $operations, + 'attributes' => array('class' => array('links', 'inline')), + )); $row[] = $ops; $rows[] = $row; @@ -231,7 +238,8 @@ class fieldable_panels_pane extends ctools_export_ui { /** * Helper method to derive paths to field UI operations. */ - function field_admin_path($name, $op) { + public function field_admin_path($name, $op) { return _field_ui_bundle_admin_path('fieldable_panels_pane', $name) . '/' . $op; } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes.views.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes.views.inc index 29f423caa37ffe15470e5dd20594317b0a871326..2ff76cc664e816a9ef623ee4e8d4ca0681643dce 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes.views.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes.views.inc @@ -12,7 +12,7 @@ function fieldable_panels_panes_views_data() { $data = array(); // ------------------------------------------------------------------------ - // Panels panes table + // Panels panes table. $data['fieldable_panels_panes'] = array( 'table' => array( 'base' => array( diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes.views_default.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes.views_default.inc index 9793a9297f1b0e5b313b35f0199144d1822e1eda..419ca9295d9e82ba0627a949a851de5e6955c50b 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes.views_default.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes.views_default.inc @@ -1,4 +1,5 @@ <?php + /** * @file * Bulk export of views_default objects generated by Bulk export module. diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_access_plugin.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_access_plugin.inc index 51875ef10c20b7434255d2b1eaa162d8855b4baf..072a3956fa1178557e045558f0c024603f8c7ce4 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_access_plugin.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_access_plugin.inc @@ -1,20 +1,34 @@ <?php + /** * @file - * Provide views access for fieldable panel panes + * Provide views access for fieldable panel panes. */ /** * Fieldable Panels Panes type Views access plugin class. */ class fieldable_panels_panes_access_plugin extends views_plugin_access { - function summary_title() { + + /** + * {@inheritdoc} + */ + public function summary_title() { return t('Custom access plugin'); } - function access($account) { + + /** + * {@inheritdoc} + */ + public function access($account) { return fieldable_panels_panes_access_callback(); } - function get_access_callback() { + + /** + * {@inheritdoc} + */ + public function get_access_callback() { return array('fieldable_panels_panes_access_callback', array()); } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_argument_bundle.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_argument_bundle.inc index 056b94c190d247a78692058be795825c6b1a4211..9087ad291e1a7e75cb191151c634092af3b7ccfc 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_argument_bundle.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_argument_bundle.inc @@ -1,29 +1,44 @@ <?php + /** * @file - * Provide views handler arguments for fieldable panel panes + * Provide views handler arguments for fieldable panel panes. */ /** * Argument handler to accept a node type. */ class fieldable_panels_panes_handler_argument_bundle extends views_handler_argument { - function summary_name($data) { + + /** + * {@inheritdoc} + */ + public function summary_name($data) { return fieldable_panels_panes_get_bundle_label($data->{$this->name_alias}); } - function title() { + /** + * {@inheritdoc} + */ + public function title() { return fieldable_panels_panes_get_bundle_label($this->argument); } - function set_argument($arg) { + /** + * {@inheritdoc} + */ + public function set_argument($arg) { // Replace all - in the URL with _ since - is not valid. $this->argument = str_replace('-', '_', $arg); return $this->validate_arg($arg); } - function summary_argument($data) { + /** + * {@inheritdoc} + */ + public function summary_argument($data) { // Transform all _ into - so that URLs are proper. return str_replace('_', '-', $data->{$this->base_alias}); } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_bundle.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_bundle.inc index a999ca49ebb54f34acd8227d14474ec2d11a1dc9..a212b9eaaa4b00791d06949b42285d7e64ec308c 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_bundle.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_bundle.inc @@ -2,14 +2,18 @@ /** * @file - * Provide views handlers for fieldable panel panes fields + * Provide views handlers for fieldable panel panes fields. */ /** * Field handler to translate a node type into its readable form. */ class fieldable_panels_panes_handler_field_bundle extends views_handler_field { - function option_definition() { + + /** + * {@inheritdoc} + */ + public function option_definition() { $options = parent::option_definition(); $options['machine_name'] = array('default' => FALSE); @@ -17,9 +21,9 @@ class fieldable_panels_panes_handler_field_bundle extends views_handler_field { } /** - * Provide machine_name option for to node type display. + * {@inheritdoc} */ - function options_form(&$form, &$form_state) { + public function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); $form['machine_name'] = array( @@ -31,7 +35,10 @@ class fieldable_panels_panes_handler_field_bundle extends views_handler_field { ); } - function render($values) { + /** + * {@inheritdoc} + */ + public function render($values) { $value = $this->get_value($values); if (!$this->options['machine_name']) { $value = fieldable_panels_panes_get_bundle_label($value); @@ -39,4 +46,5 @@ class fieldable_panels_panes_handler_field_bundle extends views_handler_field { return $this->sanitize_value($value); } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_delete_entity.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_delete_entity.inc index 4aeb8d7085eb3d5f8896556347b7c3ab4c5989ad..c5ae7b5574e3d08be7615a3a844e79377ae89449 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_delete_entity.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_delete_entity.inc @@ -1,18 +1,20 @@ <?php + /** * @file - * Provide views handlers for fieldable panel panes + * Provide views handlers for fieldable panel panes. */ /** * Field handler to present a link node delete. */ class fieldable_panels_panes_handler_field_delete_entity extends fieldable_panels_panes_handler_field_view_entity { + /** - * Renders the link. + * {@inheritdoc} */ - function render_link($entity, $values) { - if (fieldable_panels_panes_access('delete', $entity)) { + public function render_link($entity, $values) { + if (fieldable_panels_panes_access('delete', $entity) && (empty($this->options['hide_unless_reusable']) || !empty($entity->reusable))) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "admin/structure/fieldable-panels-panes/view/$entity->fpid/delete"; $this->options['alter']['query'] = drupal_get_destination(); @@ -24,4 +26,5 @@ class fieldable_panels_panes_handler_field_delete_entity extends fieldable_panel $this->options['alter']['path'] = ''; } } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_delete_revision.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_delete_revision.inc index dc392e3e1aad7654032052e87081fed4984f4bc7..288fd200991e9bdce510c030576ca0645b1c0655 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_delete_revision.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_delete_revision.inc @@ -1,17 +1,19 @@ <?php + /** * @file - * Provide views handlers for fieldable panel panes + * Provide views handlers for fieldable panel panes. */ /** * Field handler to present a link node delete. */ class fieldable_panels_panes_handler_field_delete_revision extends fieldable_panels_panes_handler_field_view_revision { + /** - * Renders the link. + * {@inheritdoc} */ - function render_link($entity, $values) { + public function render_link($entity, $values) { if (fieldable_panels_panes_access('delete', $entity)) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "admin/structure/fieldable-panels-panes/view/$entity->fpid/revision/$entity->vid/delete"; @@ -24,4 +26,5 @@ class fieldable_panels_panes_handler_field_delete_revision extends fieldable_pan $this->options['alter']['path'] = ''; } } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_edit_entity.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_edit_entity.inc index a841c482edc5e7ced8cdc2278ad41cf30291f6bf..ae8fbbfd5991cbb8aa8556dff87879508a665d2a 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_edit_entity.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_edit_entity.inc @@ -1,18 +1,20 @@ <?php + /** * @file - * Provide views handlers for fieldable panel panes + * Provide views handlers for fieldable panel panes. */ /** * Field handler to present a link node edit. */ class fieldable_panels_panes_handler_field_edit_entity extends fieldable_panels_panes_handler_field_view_entity { + /** - * Renders the link. + * {@inheritdoc} */ - function render_link($entity, $values) { - if (fieldable_panels_panes_access('update', $entity)) { + public function render_link($entity, $values) { + if (fieldable_panels_panes_access('update', $entity) && (empty($this->options['hide_unless_reusable']) || !empty($entity->reusable))) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "admin/structure/fieldable-panels-panes/view/$entity->fpid/edit"; $this->options['alter']['query'] = drupal_get_destination(); @@ -24,4 +26,5 @@ class fieldable_panels_panes_handler_field_edit_entity extends fieldable_panels_ $this->options['alter']['path'] = ''; } } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_edit_revision.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_edit_revision.inc index 1ad6e9af8f9a3dbb628b8a37b53691d3e9bf28e4..da692d2b41431cd5bde7fd0968ebf923b30a2006 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_edit_revision.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_edit_revision.inc @@ -1,17 +1,19 @@ <?php + /** * @file - * Provide views handlers for fieldable panel panes + * Provide views handlers for fieldable panel panes. */ /** * Field handler to present a link node edit. */ class fieldable_panels_panes_handler_field_edit_revision extends fieldable_panels_panes_handler_field_view_revision { + /** - * Renders the link. + * {@inheritdoc} */ - function render_link($entity, $values) { + public function render_link($entity, $values) { if (fieldable_panels_panes_access('update', $entity)) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "admin/structure/fieldable-panels-panes/view/$entity->fpid/revision/$entity->vid/edit"; @@ -24,4 +26,5 @@ class fieldable_panels_panes_handler_field_edit_revision extends fieldable_panel $this->options['alter']['path'] = ''; } } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_is_current.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_is_current.inc index fe1f40dca18311b9a1dcc477e8f0248fd2325d7d..9e42e2e1893c61c97d915110d1d9f2d7e67a4477 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_is_current.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_is_current.inc @@ -1,24 +1,32 @@ <?php + /** * @file - * Provide views handlers for fieldable panel panes + * Provide views handlers for fieldable panel panes. */ /** * Field handler to display if the revision is current or not. */ class fieldable_panels_panes_handler_field_is_current extends views_handler_field { + /** - * Stores all entities which are in the result. + * {@inheritdoc} */ public $entities; - function construct() { + /** + * {@inheritdoc} + */ + public function construct() { parent::construct(); $this->additional_fields = array('fpid', 'vid'); } - function pre_render(&$values) { + /** + * {@inheritdoc} + */ + public function pre_render(&$values) { $this->entities = array(); if (!empty($values)) { foreach ($values as $row_index => $value) { @@ -36,14 +44,20 @@ class fieldable_panels_panes_handler_field_is_current extends views_handler_fiel } } - function option_definition() { + /** + * {@inheritdoc} + */ + public function option_definition() { $options = parent::option_definition(); $options['current_text'] = array('default' => 'Current', 'translatable' => TRUE); $options['not_current_text'] = array('default' => '', 'translatable' => TRUE); return $options; } - function options_form(&$form, &$form_state) { + /** + * {@inheritdoc} + */ + public function options_form(&$form, &$form_state) { $form['current_text'] = array( '#type' => 'textfield', '#title' => t('Text to display if current'), @@ -60,9 +74,9 @@ class fieldable_panels_panes_handler_field_is_current extends views_handler_fiel } /** - * Called to add the field to a query. + * {@inheritdoc} */ - function query() { + public function query() { $this->ensure_my_table(); // This isn't a real field, but we put it there nonetheless. @@ -71,7 +85,10 @@ class fieldable_panels_panes_handler_field_is_current extends views_handler_fiel $this->add_additional_fields(); } - function sanitize_value($value, $type = NULL) { + /** + * {@inheritdoc} + */ + public function sanitize_value($value, $type = NULL) { return filter_xss_admin($value); } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_language.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_language.inc index 7a004cbf4974ff8a7547142bf5e794860b8d9957..84b8d40c4767a08918a2f57e9a4d1608bc913b8e 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_language.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_language.inc @@ -13,7 +13,7 @@ class fieldable_panels_panes_handler_field_language extends views_handler_field_ /** * {@inheritdoc} */ - function option_definition() { + public function option_definition() { $options = parent::option_definition(); $options['native_language'] = array('default' => FALSE, 'bool' => TRUE); @@ -23,7 +23,7 @@ class fieldable_panels_panes_handler_field_language extends views_handler_field_ /** * {@inheritdoc} */ - function options_form(&$form, &$form_state) { + public function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); $form['native_language'] = array( '#title' => t('Native language'), @@ -36,7 +36,7 @@ class fieldable_panels_panes_handler_field_language extends views_handler_field_ /** * {@inheritdoc} */ - function render($values) { + public function render($values) { $languages = views_language_list(empty($this->options['native_language']) ? 'name' : 'native'); $value = $this->get_value($values); $value = isset($languages[$value]) ? $languages[$value] : ''; diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_make_current.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_make_current.inc index 3631aebf1a73786d981b0d884863fb277418b61c..3bdbed4ebef403aa3e2bd8c20ff1b841b00753e7 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_make_current.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_make_current.inc @@ -1,17 +1,19 @@ <?php + /** * @file - * Provide views handlers for fieldable panel panes + * Provide views handlers for fieldable panel panes. */ /** * Field handler to present a link node edit. */ class fieldable_panels_panes_handler_field_make_current extends fieldable_panels_panes_handler_field_view_revision { + /** - * Renders the link. + * {@inheritdoc} */ - function render_link($entity, $values) { + public function render_link($entity, $values) { if (fieldable_panels_panes_entity_make_current_access($entity)) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "admin/structure/fieldable-panels-panes/view/$entity->fpid/revision/$entity->vid/make-current"; @@ -25,4 +27,5 @@ class fieldable_panels_panes_handler_field_make_current extends fieldable_panels $this->options['alter']['path'] = ''; } } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_view_entity.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_view_entity.inc index 4e31b8621d9b634067b66d1eb8ec96b4e124c0fd..5319ea59e8cf5a62e13e3cdd3190e81386fbf748 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_view_entity.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_view_entity.inc @@ -1,7 +1,8 @@ <?php + /** * @file - * Provide views handlers for fieldable panel panes + * Provide views handlers for fieldable panel panes. */ /** @@ -9,18 +10,31 @@ */ class fieldable_panels_panes_handler_field_view_entity extends views_handler_field_entity { - function option_definition() { + /** + * {@inheritdoc} + */ + public function option_definition() { $options = parent::option_definition(); $options['text'] = array('default' => '', 'translatable' => TRUE); + $options['hide_unless_reusable'] = array('default' => FALSE, 'translatable' => FALSE); return $options; } - function options_form(&$form, &$form_state) { + /** + * {@inheritdoc} + */ + public function options_form(&$form, &$form_state) { $form['text'] = array( '#type' => 'textfield', '#title' => t('Text to display'), '#default_value' => $this->options['text'], ); + $form['hide_unless_reusable'] = array( + '#type' => 'checkbox', + '#title' => t('Hide link for non-reusable panes'), + '#description' => t("If you're using revision locking, it can be useful to hide links on non-reusable panes."), + '#default_value' => $this->options['hide_unless_reusable'], + ); parent::options_form($form, $form_state); // The path is set by render_link function so don't allow to set it. @@ -28,14 +42,20 @@ class fieldable_panels_panes_handler_field_view_entity extends views_handler_fie $form['alter']['external'] = array('#access' => FALSE); } - function render($values) { + /** + * {@inheritdoc} + */ + public function render($values) { if ($entity = $this->get_value($values)) { return $this->render_link($entity, $values); } } - function render_link($entity, $values) { - if (fieldable_panels_panes_access('view', $entity)) { + /** + * {@inheritdoc} + */ + public function render_link($entity, $values) { + if (fieldable_panels_panes_access('view', $entity) && (empty($this->options['hide_unless_reusable']) || !empty($entity->reusable))) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "admin/structure/fieldable-panels-panes/view/$entity->fpid"; $text = !empty($this->options['text']) ? $this->options['text'] : t('view'); @@ -45,4 +65,5 @@ class fieldable_panels_panes_handler_field_view_entity extends views_handler_fie $this->options['alter']['path'] = ''; } } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_view_revision.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_view_revision.inc index 9c7446365c9702519216b6651fa4f6e3f6a89c8c..d99e54814a4e8f3bc0c8a5d31c1f786fceee91e2 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_view_revision.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_field_view_revision.inc @@ -1,25 +1,33 @@ <?php + /** * @file - * Provide views handlers for fieldable panel panes + * Provide views handlers for fieldable panel panes. */ /** * Field handler to present a link to the node. */ class fieldable_panels_panes_handler_field_view_revision extends views_handler_field { + /** - * Stores all entities which are in the result. + * {@inheritdoc} */ public $entities; - function construct() { + /** + * {@inheritdoc} + */ + public function construct() { parent::construct(); $this->real_field = 'fpid'; $this->additional_fields = array('vid'); } - function pre_render(&$values) { + /** + * {@inheritdoc} + */ + public function pre_render(&$values) { $this->entities = array(); if (!empty($values)) { foreach ($values as $row_index => $value) { @@ -31,19 +39,25 @@ class fieldable_panels_panes_handler_field_view_revision extends views_handler_f } /** - * Overridden to return the entity object. + * {@inheritdoc} */ - function get_value($values, $field = NULL) { + public function get_value($values, $field = NULL) { return isset($this->entities[$this->view->row_index]) ? $this->entities[$this->view->row_index] : FALSE; } - function option_definition() { + /** + * {@inheritdoc} + */ + public function option_definition() { $options = parent::option_definition(); $options['text'] = array('default' => '', 'translatable' => TRUE); return $options; } - function options_form(&$form, &$form_state) { + /** + * {@inheritdoc} + */ + public function options_form(&$form, &$form_state) { $form['text'] = array( '#type' => 'textfield', '#title' => t('Text to display'), @@ -56,13 +70,19 @@ class fieldable_panels_panes_handler_field_view_revision extends views_handler_f $form['alter']['external'] = array('#access' => FALSE); } - function render($values) { + /** + * {@inheritdoc} + */ + public function render($values) { if ($entity = $this->get_value($values)) { return $this->render_link($entity, $values); } } - function render_link($entity, $values) { + /** + * {@inheritdoc} + */ + public function render_link($entity, $values) { if (fieldable_panels_panes_access('view', $entity)) { $this->options['alter']['make_link'] = TRUE; $this->options['alter']['path'] = "admin/structure/fieldable-panels-panes/view/$entity->fpid/revision/$entity->vid"; @@ -73,4 +93,5 @@ class fieldable_panels_panes_handler_field_view_revision extends views_handler_f $this->options['alter']['path'] = ''; } } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_filter_bundle.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_filter_bundle.inc index ff6edbc3524e8a044a8f8f5b02875f6c9df55bc5..d6cc876ba3e3c3eab6d7c8428100e0d359eb08fd 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_filter_bundle.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_filter_bundle.inc @@ -1,17 +1,23 @@ <?php + /** * @file - * Provide views handlers for fieldable panel panes + * Provide views handlers for fieldable panel panes. */ /** - * Filter by node type + * Filter by node type. */ class fieldable_panels_panes_handler_filter_bundle extends views_handler_filter_in_operator { - function get_value_options() { + + /** + * {@inheritdoc} + */ + public function get_value_options() { if (!isset($this->value_options)) { $this->value_title = t('Bundles'); $this->value_options = fieldable_panels_panes_get_bundle_labels(); } } + } diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_filter_language.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_filter_language.inc index 767b8c1fb3bc2abadf09fe2457605f1d7bece10c..8fac5add66723d03541a74f3240ebd225bd194f7 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_filter_language.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/plugins/views/fieldable_panels_panes_handler_filter_language.inc @@ -1,4 +1,5 @@ <?php + /** * @file * Definition of fieldable_panels_panes_handler_filter_language. @@ -12,13 +13,13 @@ class fieldable_panels_panes_handler_filter_language extends views_handler_filte /** * {@inheritdoc} */ - function get_value_options() { + public function get_value_options() { if (!isset($this->value_options)) { $this->value_title = t('Language'); $languages = array( '***CURRENT_LANGUAGE***' => t("Current user's language"), '***DEFAULT_LANGUAGE***' => t("Default site language"), - LANGUAGE_NONE => t('No language') + LANGUAGE_NONE => t('No language'), ); $languages = array_merge($languages, views_language_list()); $this->value_options = $languages; diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.entity_form.test b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.entity_form.test index 6270420e739b8966e55f77eefbf46f096847631b..d5f47438e1d8769bd530ab9ee269249390112e9e 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.entity_form.test +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.entity_form.test @@ -1,10 +1,15 @@ <?php + /** * @file * Tests for the Fieldable Panels Panes module to ensure the basic form works. */ +/** + * Tests for the Fieldable Panels Panes module to ensure the basic form works. + */ class FppEntityFormTest extends FppTestHelper { + /** * {@inheritdoc} */ @@ -13,26 +18,14 @@ class FppEntityFormTest extends FppTestHelper { 'name' => 'FPP tests', 'description' => 'Confirm that the entity form fields work as intended.', 'group' => 'FPP', + 'dependencies' => array('ctools', 'panels', 'views'), ); } - /** - * {@inheritdoc} - */ - function setUp(array $modules = array()) { - $modules[] = 'fieldable_panels_panes'; - - parent::setUp($modules); - - // Some default values to work with. - $this->bundle = 'fieldable_panels_pane'; - $this->title = t('Test FPP'); - } - /** * Confirm that the basic form fields show on the 'add' form. */ - function testNewEntity() { + public function testNewEntity() { // Create a user with the admin permission. $this->adminUser = $this->createAdminUser(); @@ -43,7 +36,6 @@ class FppEntityFormTest extends FppTestHelper { $this->assertResponse(200); // Check all of the default fields. - // The basic title field. $this->assertFieldByName('title'); @@ -75,7 +67,7 @@ class FppEntityFormTest extends FppTestHelper { /** * Confirm that the edit form has the correct fields for reusable FPPs. */ - function testExistingReusable() { + public function testExistingReusable() { // Create a user with the admin permission. $this->adminUser = $this->createAdminUser(); @@ -93,7 +85,6 @@ class FppEntityFormTest extends FppTestHelper { $this->assertResponse(200); // Check all of the fields that are suitable for a reusable FPP. - // The basic title field. $this->assertFieldByName('title'); @@ -124,7 +115,7 @@ class FppEntityFormTest extends FppTestHelper { /** * Confirm that the edit form has the correct fields for non-reusable FPPs. */ - function testExistingNonReusable() { + public function testExistingNonReusable() { // Create a user with the admin permission. $this->adminUser = $this->createAdminUser(); @@ -142,7 +133,6 @@ class FppEntityFormTest extends FppTestHelper { $this->assertResponse(200); // Check all of the fields that are suitable for a reusable FPP. - // The basic title field. $this->assertFieldByName('title'); @@ -170,10 +160,11 @@ class FppEntityFormTest extends FppTestHelper { } /** - * Confirm that the edit form has the correct fields for non-reusable FPPs - * when the allow_reusable_access is enabled. + * Confirm that the edit form has the correct fields for non-reusable FPPs. + * + * .. when the allow_reusable_access is enabled. */ - function testAllowReusableAccessOption() { + public function testAllowReusableAccessOption() { // Create a user with the admin permission. $this->adminUser = $this->createAdminUser(); diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.file_access.test b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.file_access.test index 4fc7319733d8d9a54f190f895e3ba9c62900804d..8dfda14ceaf738bd7e681113e7f437529f2cddfd 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.file_access.test +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.file_access.test @@ -1,10 +1,15 @@ <?php + /** * @file * Tests for the Fieldable Panels Panes module to ensure file access works. */ +/** + * Tests for the Fieldable Panels Panes module to ensure file access works. + */ class FppFileAccessTest extends FppTestHelper { + /** * {@inheritdoc} */ @@ -13,29 +18,24 @@ class FppFileAccessTest extends FppTestHelper { 'name' => 'FPP tests for file access', 'description' => 'Confirm that file access logic work correctly.', 'group' => 'FPP', + 'dependencies' => array('ctools', 'panels', 'views', 'devel'), ); } /** * {@inheritdoc} */ - function setUp(array $modules = array()) { - $modules[] = 'fieldable_panels_panes'; - + public function setUp(array $modules = array()) { // Needed for the image generation logic below. $modules[] = 'devel_generate'; parent::setUp($modules); - - // Some default values to work with. - $this->bundle = 'fieldable_panels_pane'; - $this->title = t('Test FPP'); } /** * Confirm that the private file access works when no auth is defined. */ - function testFileAccessWithoutAuth() { + public function testFileAccessWithoutAuth() { // Create a user with the admin permission. $this->adminUser = $this->createAdminUser(); @@ -63,10 +63,9 @@ class FppFileAccessTest extends FppTestHelper { } /** - * Confirm that the private file access works when the visitor has the correct - * correct access. + * Confirm private file access works when the visitor DOES have access. */ - function testFileAccessWithCorrectAuth() { + public function testFileAccessWithCorrectAuth() { // Create a user with the admin permission. $this->adminUser = $this->createAdminUser(); @@ -97,10 +96,9 @@ class FppFileAccessTest extends FppTestHelper { } /** - * Confirm that the private file access works when the visitor does NOT have - * the correct access. + * Confirm private file access works when the visitor does NOT have access. */ - function testFileAccessWithIncorrectAuth() { + public function testFileAccessWithIncorrectAuth() { // Create a user with the admin permission. $this->adminUser = $this->createAdminUser(); @@ -137,7 +135,7 @@ class FppFileAccessTest extends FppTestHelper { /** * Add an image field to the FPP type that uses the private storage mechanism. */ - function addPrivateImageField() { + public function addPrivateImageField() { $this->enablePrivateFileSupport(); // Add a file field to the default FPP type. @@ -163,7 +161,7 @@ class FppFileAccessTest extends FppTestHelper { /** * Enable the private file storage scheme. */ - function enablePrivateFileSupport() { + public function enablePrivateFileSupport() { // Turn on private file access. $path = variable_get('file_public_path', conf_path() . '/files') . '/private'; variable_set('file_private_path', $path); @@ -180,7 +178,7 @@ class FppFileAccessTest extends FppTestHelper { * @return object * An FPP object. */ - function createTestFppObject() { + public function createTestFppObject() { // Generate a suitable private image file. $image = $this->generateImageFile(NULL, NULL, 'private'); @@ -204,8 +202,7 @@ class FppFileAccessTest extends FppTestHelper { } /** - * Update an FPP object so that it is make only accessible by visitors with - * the admin role. + * Update an FPP object so that it is make only accessible by admins. * * @param object $fpp * An FPP object to be made private. @@ -215,7 +212,7 @@ class FppFileAccessTest extends FppTestHelper { * @return object * The FPP object with updated access rules. */ - function makeFppObjectPrivate($fpp, $rid = 2) { + public function makeFppObjectPrivate($fpp, $rid = 2) { $fpp->view_access = array( 'plugins' => array( array( diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.helper.test b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.helper.test index aac9489461e483bb2441ed105589b07ab5336414..726290db50790fa4b9928ee4f01f11d193ee4773 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.helper.test +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.helper.test @@ -1,9 +1,13 @@ <?php + /** * @file * A base class for the Fieldable Panels Panes tests, provides shared methods. */ +/** + * A base class for the Fieldable Panels Panes tests, provides shared methods. + */ abstract class FppTestHelper extends DrupalWebTestCase { /** @@ -16,9 +20,13 @@ abstract class FppTestHelper extends DrupalWebTestCase { /** * {@inheritdoc} */ - function setUp(array $modules = array()) { + public function setUp(array $modules = array()) { $modules[] = 'fieldable_panels_panes'; parent::setUp($modules); + + // Some default values to work with. + $this->bundle = 'fieldable_panels_pane'; + $this->title = t('Test'); } /** @@ -30,7 +38,7 @@ abstract class FppTestHelper extends DrupalWebTestCase { * @return object * A standard Drupal user object. */ - function createAdminUser(array $perms = array()) { + public function createAdminUser(array $perms = array()) { // Create a user with the admin permission. $permissions = array( // The master permission for FPP. @@ -53,7 +61,7 @@ abstract class FppTestHelper extends DrupalWebTestCase { * @return object * A standard Drupal user object. */ - function createUser(array $perms = array()) { + public function createUser(array $perms = array()) { // Reset the static variable used to identify permissions, otherwise it's // possible the permissions check in drupalCreateUser will fail. $this->checkPermissions(array(), TRUE); @@ -65,15 +73,17 @@ abstract class FppTestHelper extends DrupalWebTestCase { /** * Create an image of a specific size & type. * - * @param string + * @param string $image_size * The size of the requested image in 'XxY' format; defaults to '200x200'. - * @param string - * The image format to use, defaults to 'png'. + * @param string $format + * The image format to use; defaults to 'png'. + * @param string $scheme + * The storage scheme to use; defaults to 'public'. * * @return string * The URL to a public file. */ - function generateImage($image_size = '200x200', $format = 'png', $scheme = 'public') { + public function generateImage($image_size = '200x200', $format = 'png', $scheme = 'public') { // Only proceed if the Devel Generate module is installed. if (module_exists('devel_generate')) { // Load the Devel Generate image generator logic. @@ -104,7 +114,7 @@ abstract class FppTestHelper extends DrupalWebTestCase { * @return object * The file object for the generated image. */ - function generateImageFile($image_size = '200x200', $format = 'png', $scheme = 'public') { + public function generateImageFile($image_size = '200x200', $format = 'png', $scheme = 'public') { // Generate a test image. $image_uri = $this->generateImage($image_size, $format, $scheme); diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.locale.test b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.locale.test index a5da2ecdc5fc457dafb4fc80314f49a41d26374e..5ed23844a211643bb9370c152ab51bfae7e1f7f6 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.locale.test +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.locale.test @@ -1,9 +1,13 @@ <?php + /** * @file * Confirm the language integration works correctly. */ +/** + * Confirm the language integration works correctly. + */ class FppLocaleTest extends FppTestHelper { /** @@ -14,29 +18,24 @@ class FppLocaleTest extends FppTestHelper { 'name' => 'FPP tests for language handling', 'description' => 'Confirm that language handling works correctly.', 'group' => 'FPP', + 'dependencies' => array('ctools', 'panels', 'views'), ); } /** * {@inheritdoc} */ - function setUp(array $modules = array()) { - $modules[] = 'fieldable_panels_panes'; - - // Needed + public function setUp(array $modules = array()) { + // Needed. $modules[] = 'locale'; parent::setUp($modules); - - // Some default values to work with. - $this->bundle = 'fieldable_panels_pane'; - $this->title = 'Test FPP'; } /** * Verify the language selector exists. */ - function testLanguageSelector() { + public function testLanguageSelector() { // Create a user with the admin permission. $this->adminUser = $this->createAdminUser(); @@ -53,7 +52,7 @@ class FppLocaleTest extends FppTestHelper { /** * Verify the language selector exists. */ - function testNoLanguageSelector() { + public function testNoLanguageSelector() { module_disable(array('locale')); // Create a user with the admin permission. @@ -72,7 +71,7 @@ class FppLocaleTest extends FppTestHelper { /** * Verify the language selector works with no language selected. */ - function testLanguageNone() { + public function testLanguageNone() { // Create a user with the admin permission. $this->adminUser = $this->createAdminUser(); @@ -106,7 +105,7 @@ class FppLocaleTest extends FppTestHelper { /** * Verify the language selector works with a specific language. */ - function testLanguageEnglish() { + public function testLanguageEnglish() { // Create a user with the admin permission. $this->adminUser = $this->createAdminUser(); diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.permissions.test b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.permissions.test index 7e502e5683fd849fa5288a15ffbcc04ab30ddf5e..35d54dc3edf1bc103d557dccb0169b3de2a8dc42 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.permissions.test +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.permissions.test @@ -1,10 +1,15 @@ <?php + /** * @file * Tests for the Fieldable Panels Panes module to ensure the permissions work. */ +/** + * Tests for the Fieldable Panels Panes module to ensure the permissions work. + */ class FppPermissionsTest extends FppTestHelper { + /** * {@inheritdoc} */ @@ -13,25 +18,14 @@ class FppPermissionsTest extends FppTestHelper { 'name' => 'FPP tests for permissions', 'description' => 'Confirm that the different permissions work correctly.', 'group' => 'FPP', + 'dependencies' => array('ctools', 'panels', 'views'), ); } - /** - * {@inheritdoc} - */ - function setUp(array $modules = array()) { - $modules[] = 'fieldable_panels_panes'; - parent::setUp($modules); - - // Some default values to work with. - $this->bundle = 'fieldable_panels_pane'; - $this->title = t('Test'); - } - /** * Confirm that the 'admin' permission works correctly. */ - function testAdminPermission() { + public function testAdminPermission() { // Create a user with the admin permission. $this->adminUser = $this->createAdminUser(); @@ -63,8 +57,9 @@ class FppPermissionsTest extends FppTestHelper { $this->drupalGet('admin/structure/fieldable-panels-panes/' . $this->bundle . '/delete'); $this->assertResponse(200, 'Loaded the Delete page for the default FPP type.'); - $this->assertText(t('This action will permanently remove this item from your database..')); - + $this->assertText(t('Are you sure you want to delete')); + $this->assertText(t('This action will permanently remove this item from your database.')); + return; $this->drupalGet('admin/structure/fieldable-panels-panes/' . $this->bundle . '/export'); $this->assertResponse(200, 'Loaded the Export page for the default FPP type.'); $this->assertFieldByName('code'); @@ -89,7 +84,7 @@ class FppPermissionsTest extends FppTestHelper { /** * Confirm that the 'list' permission works correctly. */ - function testListPermission() { + public function testListPermission() { // Create a user with the admin permission. $permissions = array( 'access fieldable panels panes master list', @@ -106,7 +101,7 @@ class FppPermissionsTest extends FppTestHelper { /** * Confirm that the 'create bundle' permission works correctly. */ - function testCreateBundlePermission() { + public function testCreateBundlePermission() { // Create a user with the admin permission. $permissions = array( "create fieldable {$this->bundle}", @@ -146,7 +141,7 @@ class FppPermissionsTest extends FppTestHelper { /** * Confirm that the 'edit bundle' permission doesn't allow FPP creation. */ - function testEditBundlePermission() { + public function testEditBundlePermission() { // Create a user with edit permission. $permissions = array( "edit fieldable {$this->bundle}", @@ -162,7 +157,7 @@ class FppPermissionsTest extends FppTestHelper { /** * Confirm that the 'edit bundle' permission works correctly. */ - function testCreateEditBundlePermission() { + public function testCreateEditBundlePermission() { // Create a user with create & edit permission. $permissions = array( "create fieldable {$this->bundle}", @@ -196,7 +191,7 @@ class FppPermissionsTest extends FppTestHelper { /** * Confirm that the 'delete bundle' permission works correctly. */ - function testDeleteBundlePermission() { + public function testDeleteBundlePermission() { // Create a user with the admin permission. $permissions = array( "create fieldable {$this->bundle}", diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.services.test b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.services.test new file mode 100644 index 0000000000000000000000000000000000000000..ff1df61cb2149a20ab26b08057ab3efc22628a07 --- /dev/null +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.services.test @@ -0,0 +1,314 @@ +<?php + +/** + * @file + * Tests the services resource Fieldable Panels Pane methods and actions. + */ + + /** + * Test the services resource Fieldable Panels Pane methods and actions. + */ +class FppServicesTest extends ServicesWebTestCase { + + /** + * The endpoint created for these tests. + * + * @var object + */ + protected $endpoint = NULL; + + /** + * {@inheritdoc} + */ + public static function getInfo() { + return array( + 'name' => 'FPP tests for Services integration', + 'description' => 'Test the services resource Fieldable Panels Pane methods and actions.', + 'group' => 'FPP', + // The Services rest_service module requires libraries too. + 'dependencies' => array('ctools', 'panels', 'views', 'services', 'libraries'), + ); + } + + /** + * {@inheritdoc} + */ + public function setUp(array $modules = array()) { + // Because this test extends ServicesWebTestCase instead of FppTestHelper + // the FPP module needs to be specifically listed here. + $modules[] = 'fieldable_panels_panes'; + parent::setUp($modules); + + // Create an endpoint. + $this->endpoint = $this->saveNewEndpoint(); + } + + /** + * {@inheritdoc} + */ + public function saveNewEndpoint() { + $edit = $this->populateEndpointFAPI(); + $endpoint = new stdClass(); + $endpoint->disabled = FALSE; + $endpoint->api_version = 3; + $endpoint->name = $edit['name']; + $endpoint->server = $edit['server']; + $endpoint->path = $edit['path']; + $endpoint->authentication = array( + 'services' => 'services', + ); + $endpoint->server_settings = array( + 'formatters' => array( + 'json' => TRUE, + 'bencode' => TRUE, + 'rss' => TRUE, + 'plist' => TRUE, + 'xmlplist' => TRUE, + 'php' => TRUE, + 'yaml' => TRUE, + 'jsonp' => FALSE, + 'xml' => FALSE, + ), + 'parsers' => array( + 'application/x-yaml' => TRUE, + 'application/json' => TRUE, + 'application/vnd.php.serialized' => TRUE, + 'application/plist' => TRUE, + 'application/plist+xml' => TRUE, + 'application/x-www-form-urlencoded' => TRUE, + 'multipart/form-data' => TRUE, + ), + ); + $endpoint->resources = array( + 'fieldable_panels_panes' => array( + 'operations' => array( + 'create' => array( + 'enabled' => 1, + ), + 'retrieve' => array( + 'enabled' => 1, + ), + 'update' => array( + 'enabled' => 1, + ), + 'delete' => array( + 'enabled' => 1, + ), + 'index' => array( + 'enabled' => 1, + ), + ), + ), + ); + $endpoint->debug = 1; + $endpoint->export_type = FALSE; + services_endpoint_save($endpoint); + $endpoint = services_endpoint_load($endpoint->name); + $this->assertEqual($endpoint->name, $edit['name'], 'Endpoint successfully created'); + return $endpoint; + } + + /** + * Tests FPP resource Index. + */ + public function testFppIndex() { + $privileged_user = $this->drupalCreateUser(array( + 'administer services', + 'administer fieldable panels panes', + 'perform unlimited index queries', + )); + $this->drupalLogin($privileged_user); + + // Create a set of FPP entities. The FPP resource returns 20 items at a + // time, so this creates 2 1/2 pages worth. + $fpps = array(); + $count = 50; + for ($i = 0; $i < $count; $i++) { + $fpp = $this->createFpp(); + $fpps[$fpp->fpid] = $fpp; + } + + // Get the content. + $page_count = ceil(count($fpps) / 20); + $retrieved_fpps = array(); + for ($page = 0; $page < $page_count; $page++) { + $responseArray = $this->servicesGet($this->endpoint->path . '/fieldable_panels_panes', array('page' => $page, 'fields' => 'fpid,title')); + $this->assertTrue(count($responseArray['body']) <= 20, 'Correct number of items returned'); + + // Store the returned FPP IDs. + foreach ($responseArray['body'] as $fpp) { + if (isset($retrieved_fpps[$fpp->fpid])) { + $this->fail(format_string('Duplicate fieldable panels pane @fpid returned.', array('@fpid' => $fpp->fpid))); + } + $retrieved_fpps[$fpp->fpid] = TRUE; + + $this->assertEqual($fpps[$fpp->fpid]->title, $fpp->title, 'Successfully received fieldable panels pane info', 'fppResource: Index'); + } + } + + // Verify we retrieved all the FPPs. + $expected_fpids = array_keys($fpps); + sort($expected_fpids); + $retrieved_fpids = array_keys($retrieved_fpps); + sort($retrieved_fpids); + $this->assertEqual($expected_fpids, $retrieved_fpids, 'Retrieved all fieldable panels panes'); + + // The n+1 page should be empty. + $responseArray = $this->servicesGet($this->endpoint->path . '/fieldable_panels_panes', array('page' => $page_count + 1)); + $this->assertEqual(count($responseArray['body']), 0, 'The n+1 page is empty'); + + // Adjust the pager size. + $responseArray = $this->servicesGet($this->endpoint->path . '/fieldable_panels_panes', array('fields' => 'fpid,title', 'pagesize' => 40)); + $this->assertEqual(count($responseArray['body']), 40, 'Correct number of items returned'); + + // Swap to user that can only use the default pager size. + $less_privileged_user = $this->drupalCreateUser(array( + 'administer services', + 'administer fieldable panels panes', + )); + $this->drupalLogin($less_privileged_user); + $responseArray = $this->servicesGet($this->endpoint->path . '/fieldable_panels_panes', array('fields' => 'fpid,title', 'pagesize' => 40)); + $this->assertEqual(count($responseArray['body']), 20, 'Correct number of items returned'); + } + + /** + * Tests FPP resource Retrieve. + */ + public function testFppRetrieve() { + $privileged_user = $this->drupalCreateUser(array( + 'administer services', + 'administer fieldable panels panes', + )); + $this->drupalLogin($privileged_user); + + // Verify FPP entity is found. + $fpp = $this->createFpp(); + $responseArray = $this->servicesGet($this->endpoint->path . '/fieldable_panels_panes/' . $fpp->fpid); + $this->assertTrue($fpp->title == $responseArray['body']->title, + 'Successfully received fieldable panels pane info', 'fppResource: Retrieve'); + + // Verify FPP entity not found. + unset($fpp); + $responseArray = $this->servicesGet($this->endpoint->path . '/fieldable-panels-pane/99'); + $this->assertTrue($responseArray['code'] == '404', 'Successfully was rejected to non existent fieldable panels pane', 'fppResource: Retrieve'); + } + + /** + * Tests FPP resource Create. + */ + public function testFppCreate() { + $privileged_user = $this->drupalCreateUser(array( + 'administer services', + 'administer fieldable panels panes', + 'create fieldable fieldable_panels_pane', + )); + $this->drupalLogin($privileged_user); + $fpp = array( + 'title' => 'Tests', + 'bundle' => 'fieldable_panels_pane', + ); + + $response = $this->servicesPost($this->endpoint->path . '/fieldable_panels_panes', $fpp); + $body = $response['body']; + + $this->assertTrue(isset($body['fpid']), 'fieldable panels pane was successfully created', 'fppResource: Create'); + $new_fpp = fieldable_panels_panes_load($body['fpid']); + $this->assertEqual($new_fpp->title, $fpp['title'], 'Title was the same', 'fppResource: Create'); + } + + /** + * Tests FPP resource Created. + * + * Make sure it fails with no permissions. + */ + public function testFppCreateFail() { + $privileged_user = $this->drupalCreateUser(array( + 'administer services', + )); + $this->drupalLogin($privileged_user); + $fpp = array( + 'title' => 'Tests', + 'bundle' => 'fieldable_panels_pane', + ); + + $responseArray = $this->servicesPost($this->endpoint->path . '/fieldable_panels_panes', $fpp); + + $this->assertEqual($responseArray['code'], 403, 'User with not sufficient permissions cannot create fieldable panels pane', 'fppResource: Create'); + } + + /** + * Tests FPP resource Update. + */ + public function testFppUpdate() { + $privileged_user = $this->drupalCreateUser(array( + 'administer services', + 'administer fieldable panels panes', + 'edit fieldable fieldable_panels_pane', + )); + $this->drupalLogin($privileged_user); + + $fpp = $this->createFpp(); + $fpp_update = (array) $fpp; + $fpp_update['title'] = $this->randomName(); + + $this->servicesPut($this->endpoint->path . '/fieldable_panels_panes/' . $fpp->fpid, $fpp_update); + $fppAfterUpdate = fieldable_panels_panes_load($fpp->fpid); + $this->assertTrue(isset($fppAfterUpdate->fpid), 'fieldable panels pane was successfully updated', 'fppResource: Updated'); + $this->assertEqual($fppAfterUpdate->title, $fpp_update['title'], 'Title is the same', 'fppResource: Update'); + } + + /** + * Tests FPP resource Update fail with no permissions. + */ + public function testFppUpdatePermFail() { + $privileged_user = $this->drupalCreateUser(array( + 'administer services', + )); + $this->drupalLogin($privileged_user); + + $fpp = $this->createFpp(); + + // Try to update this FPP entity with a user that does not have + // permission to edit any fieldable_panels_pane content. + $fpp_update = (array) $fpp; + $fpp_update['title'] = $this->randomName(); + + $responseArray = $this->servicesPut($this->endpoint->path . '/fieldable_panels_panes/' . $fpp->fpid, $fpp_update); + + $this->assertTrue(strpos($responseArray['status'], 'Access denied for user'), + 'Updating the fieldable panels pane failed without needed permissions.', 'fppResource: Update'); + } + + /** + * Tests FPP resource Delete. + */ + public function testFppDelete() { + $privileged_user = $this->drupalCreateUser(array( + 'administer services', + 'administer fieldable panels panes', + 'delete fieldable fieldable_panels_pane', + )); + $this->drupalLogin($privileged_user); + $fpp = $this->createFpp(); + + $this->servicesDelete($this->endpoint->path . '/fieldable_panels_panes/' . $fpp->fpid); + $deleted_fieldable_panels_pane = fieldable_panels_panes_load($fpp->fpid); + $this->assertTrue(empty($deleted_fieldable_panels_pane), 'fieldable panels pane was deleted.', 'fppResource: Deleted'); + + // Verify trying to delete a non-existing FPP fails. + $responseArray = $this->servicesDelete($this->endpoint->path . '/fieldable_panels_panes/' . $fpp->fpid); + $this->assertNotEqual($responseArray['code'], 200, + 'fieldable panels pane was deleted. It shoudlnt have been because it doesnt exist', 'fppResource: Deleted'); + } + + /** + * Helper function to create an FPP. + */ + public function createFpp() { + $fpp = new StdClass(); + $fpp->bundle = 'fieldable_panels_pane'; + $fpp->title = $this->randomString(); + return fieldable_panels_panes_save($fpp); + } + +} diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_panelizer.test b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_panelizer.test index ddca4bd2321268b61f5b8effaaef45e90f3a3501..2f8d98be58c9ba4ea685e548793d882a6412d2d0 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_panelizer.test +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_panelizer.test @@ -1,10 +1,15 @@ <?php + /** * @file * Tests for the Fieldable Panels Panes module with Panelizer. */ +/** + * Tests for the Fieldable Panels Panes module with Panelizer. + */ class FppWithPanelizerTest extends FppTestHelper { + /** * {@inheritdoc} */ @@ -13,25 +18,26 @@ class FppWithPanelizerTest extends FppTestHelper { 'name' => 'FPP tests for Panelizer', 'description' => 'Confirm that FPP works with Panelizer.', 'group' => 'FPP', + 'dependencies' => array('ctools', 'panels', 'views', 'panelizer'), ); } /** * {@inheritdoc} */ - function setUp(array $modules = array()) { - $modules[] = 'fieldable_panels_panes'; - + public function setUp(array $modules = array()) { // Needed for node display. $modules[] = 'panelizer'; parent::setUp($modules); - - // Some default values to work with. - $this->bundle = 'fieldable_panels_pane'; } - function testAddingPanelizer() { + /** + * Test Panelizer integration. + * + * @todo Do this. + */ + public function toDoTestPanelizer() { // Enable Revisioning. // Enable Panelizer. // Customize a node. diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_panels.test b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_panels.test index 126fcbc0c39d4aab8946a5e6e8061eb1ad82e34c..7a6e8f39814316a42117eee4eb695606273964c5 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_panels.test +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_panels.test @@ -1,9 +1,13 @@ <?php + /** * @file * Tests for the Fieldable Panels Panes module with Panels. */ +/** + * Tests for the Fieldable Panels Panes module with Panels. + */ class FppWithPanelsTest extends FppTestHelper { /** @@ -14,24 +18,20 @@ class FppWithPanelsTest extends FppTestHelper { 'name' => 'FPP tests for Panels', 'description' => 'Confirm that FPP works with Panels.', 'group' => 'FPP', + 'dependencies' => array('ctools', 'panels', 'views'), ); } /** * {@inheritdoc} */ - function setUp(array $modules = array()) { - $modules[] = 'fieldable_panels_panes'; - + public function setUp(array $modules = array()) { // Helper. $modules[] = 'fpp_with_panels_test'; parent::setUp($modules); - // Some default values to work with. - $this->bundle = 'fieldable_panels_pane'; - - // Create a user with all the permissions + // Create a user with all the permissions. $permissions = array( // Needed for Page Manager. 'administer page manager', @@ -44,7 +44,7 @@ class FppWithPanelsTest extends FppTestHelper { /** * Make sure admin titles with XSS code can't break the site. */ - function testAdminTitleLinkWithAmpersands() { + public function testAdminTitleLinkWithAmpersands() { // Create an FPP with an XSS payload in the admin title. $fpp = new StdClass(); $fpp->bundle = $this->bundle; @@ -103,7 +103,7 @@ class FppWithPanelsTest extends FppTestHelper { /** * Make sure titles with XSS code can't break the site. */ - function testTitleXSS() { + public function testTitleXss() { // Create an FPP with an XSS payload in the entity title. $fpp = new StdClass(); $fpp->bundle = $this->bundle; @@ -112,13 +112,13 @@ class FppWithPanelsTest extends FppTestHelper { $fpp->admin_title = ''; $fpp = fieldable_panels_panes_save($fpp); - $this->checkAdminUIPaneTitleXSS($fpp); + $this->checkAdminUiPaneTitleXss($fpp); } /** * Make sure admin titles with XSS code can't break the site. */ - function testAdminTitleXSS() { + public function testAdminTitleXss() { // Create an FPP with an XSS payload in the admin title. $fpp = new StdClass(); $fpp->bundle = $this->bundle; @@ -127,7 +127,7 @@ class FppWithPanelsTest extends FppTestHelper { $fpp->admin_title = "<script>alert('XSS!');</script>"; $fpp = fieldable_panels_panes_save($fpp); - $this->checkAdminUIPaneTitleXSS($fpp); + $this->checkAdminUiPaneTitleXss($fpp); } /** @@ -136,7 +136,7 @@ class FppWithPanelsTest extends FppTestHelper { * @param object $fpp * A full FPP entity object. */ - function checkAdminUIPaneTitleXSS($fpp) { + public function checkAdminUiPaneTitleXss($fpp) { // Load the test Panels page. ctools_include('page', 'page_manager', 'plugins/tasks'); $page = page_manager_page_load('fpp_with_panels_test'); diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_panels_and_entity.test b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_panels_and_entity.test index 7e33aaeffbc657d6424389594501f0f349edb3e7..ea0876884bf5f0d68ec21e6cccf51a4fac2c25fb 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_panels_and_entity.test +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_panels_and_entity.test @@ -1,9 +1,13 @@ <?php + /** * @file * Tests for the Fieldable Panels Panes module with Panels and Entity API. */ +/** + * Tests for the Fieldable Panels Panes module with Panels and Entity API. + */ class FppWithPanelsAndEntityTest extends FppWithPanelsTest { /** @@ -14,13 +18,14 @@ class FppWithPanelsAndEntityTest extends FppWithPanelsTest { 'name' => 'FPP tests for Panels and Entity API', 'description' => 'Confirm that FPP+Panes continues working when Entity API is enabled.', 'group' => 'FPP', + 'dependencies' => array('ctools', 'panels', 'views', 'entity'), ); } /** * {@inheritdoc} */ - function setUp(array $modules = array()) { + public function setUp(array $modules = array()) { // Entity API. $modules[] = 'entity'; diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_pathauto.test b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_pathauto.test index 626355d101bdd16d6e1bdceb1e093ade4b392e1c..904af0c39cfe109aaec2db04167f757aceecc5aa 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_pathauto.test +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_pathauto.test @@ -1,10 +1,15 @@ <?php + /** * @file * Tests for the Fieldable Panels Panes module with Pathauto. */ +/** + * Tests for the Fieldable Panels Panes module with Pathauto. + */ class FppWithPathautoTest extends FppTestHelper { + /** * {@inheritdoc} */ @@ -13,25 +18,23 @@ class FppWithPathautoTest extends FppTestHelper { 'name' => 'FPP tests for Pathauto', 'description' => 'Confirm that FPP does not break when using Pathauto.', 'group' => 'FPP', + 'dependencies' => array('ctools', 'panels', 'views', 'pathauto'), ); } /** * {@inheritdoc} */ - function setUp(array $modules = array()) { - $modules[] = 'fieldable_panels_panes'; - - // + public function setUp(array $modules = array()) { $modules[] = 'pathauto'; parent::setUp($modules); - - // Some default values to work with. - $this->bundle = 'fieldable_panels_pane'; } - function testPathauto() { + /** + * Test the Pathauto integration. + */ + public function testPathauto() { // Create a test node. $node = $this->drupalCreateNode(); diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_revisioning.test b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_revisioning.test index 001fc4326710cba3c8708116957e96bfacdf0c1d..ccbb68c512bda2d7803dadf5174d9e9d6c5f0ae1 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_revisioning.test +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp.with_revisioning.test @@ -1,10 +1,15 @@ <?php + /** * @file * Tests for the Fieldable Panels Panes module with Revisioning. */ +/** + * Tests for the Fieldable Panels Panes module with Revisioning. + */ class FppWithRevisioningTest extends FppTestHelper { + /** * {@inheritdoc} */ @@ -13,28 +18,29 @@ class FppWithRevisioningTest extends FppTestHelper { 'name' => 'FPP tests for Revisioning', 'description' => 'Confirm that pane revisioning works correctly.', 'group' => 'FPP', + 'dependencies' => array('ctools', 'panels', 'views', 'panelizer', 'revisioning'), ); } /** * {@inheritdoc} */ - function setUp(array $modules = array()) { - $modules[] = 'fieldable_panels_panes'; + public function setUp(array $modules = array()) { + // Needed for node display. + $modules[] = 'panelizer'; // Needed for workflow logic. $modules[] = 'revisioning'; - // Needed for node display. - $modules[] = 'panelizer'; - parent::setUp($modules); - - // Some default values to work with. - $this->bundle = 'fieldable_panels_pane'; } - function testAddingPanelizer() { + /** + * Test Revisioning integration. + * + * @todo Do this. + */ + public function toDoTestRevisioning() { // Enable Revisioning. // Enable Panelizer. // Customize a node. diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp_with_panels_test.info b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp_with_panels_test.info index 02383526ced0724617d4b3d150b0467631e3895e..0a961aea4c1b60324e132f5b73aacc578f68d878 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp_with_panels_test.info +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp_with_panels_test.info @@ -9,9 +9,8 @@ dependencies[] = ctools dependencies[] = page_manager dependencies[] = fieldable_panels_panes -; Information added by Drupal.org packaging script on 2016-11-05 -version = "7.x-1.11" +; Information added by Drupal.org packaging script on 2019-03-04 +version = "7.x-1.12" core = "7.x" project = "fieldable_panels_panes" -datestamp = "1478371741" - +datestamp = "1551731287" diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp_with_panels_test.module b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp_with_panels_test.module index 11746aa07c30bc8cd919bbbc0d47be9540cf8ef6..41c6a51df5f20cc3fcfb9d657186f7854bb64a4d 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp_with_panels_test.module +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp_with_panels_test.module @@ -1,4 +1,5 @@ <?php + /** * @file * Primary hook implementations. diff --git a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp_with_panels_test.pages_default.inc b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp_with_panels_test.pages_default.inc index 5d37864299647636a2a05970ae81f5335ca19e7d..2f1cee79cffa6abc6da88af34ed2df3a59f93b0f 100644 --- a/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp_with_panels_test.pages_default.inc +++ b/profiles/wcm_base/modules/contrib/fieldable_panels_panes/tests/fpp_with_panels_test.pages_default.inc @@ -1,7 +1,8 @@ <?php + /** * @file - * fpp_with_panels_test.pages_default.inc + * Fpp_with_panels_test.pages_default.inc. */ /** diff --git a/profiles/wcm_base/modules/custom/ocio_news/ocio_news.context.inc b/profiles/wcm_base/modules/custom/ocio_news/ocio_news.context.inc index 859339eefa53608a1f997b2d59a94021c2a850d5..83b43a802f6672d0e1a9330fd9a44c4fa81723a6 100644 --- a/profiles/wcm_base/modules/custom/ocio_news/ocio_news.context.inc +++ b/profiles/wcm_base/modules/custom/ocio_news/ocio_news.context.inc @@ -17,6 +17,14 @@ function ocio_news_context_default_contexts() { $context->description = 'predefined page layout for news archive page'; $context->tag = 'OCIO News'; $context->conditions = array( + 'node' => array( + 'values' => array( + 'article' => 'article', + ), + 'options' => array( + 'node_form' => '2', + ), + ), 'path' => array( 'values' => array( 'news' => 'news', diff --git a/profiles/wcm_base/modules/custom/ocio_news/ocio_news.features.field_instance.inc b/profiles/wcm_base/modules/custom/ocio_news/ocio_news.features.field_instance.inc index 4219a36b939d235bba32f9c76e9aff9e7120d679..7392440cafdeb885bf31e0aaa6300d1ad7f29b4e 100644 --- a/profiles/wcm_base/modules/custom/ocio_news/ocio_news.features.field_instance.inc +++ b/profiles/wcm_base/modules/custom/ocio_news/ocio_news.features.field_instance.inc @@ -204,10 +204,15 @@ function ocio_news_field_default_field_instances() { 'label' => 'Image', 'required' => 0, 'settings' => array( + 'alt_field' => 0, + 'default_image' => 0, 'description_field' => 0, 'file_directory' => '[current-date:custom:Y]/[current-date:custom:m]/[current-date:custom:d]', 'file_extensions' => 'png gif jpg jpeg', 'max_filesize' => '', + 'max_resolution' => '', + 'min_resolution' => '', + 'title_field' => 0, 'user_register_form' => FALSE, ), 'widget' => array( diff --git a/profiles/wcm_base/wcm_base.make b/profiles/wcm_base/wcm_base.make index 8e3c98a74235bd4e97cd33fa298773482e12e8ac..eb08ff0d21b7ca69a65514bf7396b06fda996d64 100644 --- a/profiles/wcm_base/wcm_base.make +++ b/profiles/wcm_base/wcm_base.make @@ -52,7 +52,7 @@ projects[features_extra][subdir] = contrib projects[field_group][version] = 1.6 projects[field_group][subdir] = contrib -projects[fieldable_panels_panes][version] = 1.11 +projects[fieldable_panels_panes][version] = 1.12 projects[fieldable_panels_panes][subdir] = contrib projects[file_entity][version] = 2.4