Skip to main content

AI Query of the week: What are super agents? Explain in one line

Gemini Response: Super agents are powerful talent representatives who manage high-profile athletes and entertainers, wielding significant influence in their clients' careers.

Drupal StackExchange

On a content page that references a taxonomy term, how can I display only content that references that taxonomy term's immediate children?

2 hours 39 minutes ago

In Drupal 8, I have a hierarchical taxonomy vocabulary called "Living Things" containing these terms:

Animals --Fishes ----Blennies ------Yellow Blenny ------Green Blenny ----Gobies ------Blue Goby ------Red Goby

I have created a custom content type called "Taxon Page" which includes a single reference to the "Living Things" vocabulary.

Using the "Taxon Page" content type I have created a page for each of the terms in the "Living Things" vocabulary. So for example, my "Yellow Blenny Facts" content page contains a reference to the "Yellow Blenny" taxonomy term.

On those "Taxon Page" content pages, how can I display only content that references that taxonomy term's immediate children (if there are any)? For example, the "Fishes Facts" content page should display data from the "Blennies Facts" and "Gobies Facts" content (not just a link to those taxonomy terms), but not their children.

I have tried to achieve this by creating a view for "Content type (= Taxon Page)" and adding a "contextual filter: Content: Has taxonomy term ID (with depth)" (depth of 1) but it did not work.

Note that this question is related but different, as it only refers to taxonomy terms, not content referencing those taxonomy terms.

Nick Hope

Stuck in my config import because of guzzlehttp/guzzle error

3 hours 35 minutes ago

I am trying to import the config from another of my Drupal 9.1.4 projects with Composer / Drush (drush config-import from a folder source, all two websites on my local repository on Xampp), but a guzzlehttp/guzzle error is thrown in the middle of the process, whatever I try...

Error: Call to undefined method GuzzleHttp\Utils::chooseHandler() in GuzzleHttp\choose_handler() (line 61 of C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\guzzlehttp\guzzle\src\functions.php).

I have tried to reinstall everything from the beginning (including composer, drush, modules' dependencies...), to test with a fresh drupal/core install, to investigate guzzlehttp/guzzle dependencies, but at the end this error keeps showing up... Raaaaaahhhh !! I wonder if it could be related with multiple version requirements of guzzlehttp/guzzle caused by a faulty installation with consolidation/cgr in different places of my repository (i.e "6.5.5" in my project but "7.2" globally)?

When I try to update guzzlehttp/guzzle to 7.2 version in my project, the error message seems to confirm this, but I can't figure out what to do:

Your requirements could not be resolved to an installable set of packages. Problem 1 - drupal/core-recommended is locked to version 9.1.4 and an update of this package was not requested. - drupal/core-recommended 9.1.4 requires guzzlehttp/guzzle 6.5.5 -> found guzzlehttp/guzzle[6.5.5] but it conflicts with your root composer.json require (^7.2). Problem 2 - drupal/core 9.1.4 requires guzzlehttp/guzzle ^6.5.2 -> found guzzlehttp/guzzle[6.5.2, ..., 6.5.x-dev] but it conflicts with your root composer.json require (^7.2). - drupal/views_url_path_arguments 1.1.0 requires drupal/core ^8 || ^9 -> satisfiable by drupal/core[9.1.4]. - drupal/views_url_path_arguments is locked to version 1.1.0 and an update of this package was not requested. Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions. Installation failed, reverting ./composer.json and ./composer.lock to their original content.

I'm a beginner with Composer / Drush-managed installs: some tips would be most welcome. Thank you by advance for your help!

If needed, here are my installed packages:

asm89/stack-cors 1.3.0 clue/stream-filter v1.5.0 commerceguys/addressing v1.1.1 composer/installers v1.10.0 composer/semver 3.2.2 davedevelopment/stiphle 0.9.2 doctrine/annotations 1.11.1 doctrine/cache 1.10.2 doctrine/collections 1.6.7 doctrine/common 2.13.3 doctrine/event-manager 1.1.1 doctrine/inflector 1.4.3 doctrine/lexer 1.2.1 doctrine/persistence 1.3.8 doctrine/reflection 1.2.2 drupal/address 1.9.0 drupal/admin_toolbar 3.0.0 drupal/advanced_text_formatter 2.0.0 drupal/allowed_formats 1.3.0 drupal/asset_injector 2.7.0 drupal/auto_entitylabel 3.0.0-beta4 drupal/backup_migrate 5.0.0-rc2 drupal/better_exposed_filters 5.0.0-beta1 drupal/boolean_single_state_formatter 1.1.0 drupal/bootstrap_business 1.0.0-beta4 drupal/calendar 1.0.0-alpha3 drupal/calendar_datetime 1.0.0-alpha3 drupal/charts 5.0.0-alpha2 drupal/color_field 2.4.0 drupal/colorbox 1.6.0 drupal/colorbutton 1.2.0 drupal/composer_deploy 1.6.0 drupal/conditional_fields 1.0.0-alpha10 drupal/config_update 1.7.0 drupal/context 4.0.0-beta5 drupal/core 9.1.4 drupal/core-composer-scaffold 9.1.4 drupal/core-project-message 9.1.4 drupal/core-recommended 9.1.4 drupal/core-vendor-hardening 9.1.4 drupal/crop 2.1.0 drupal/css_editor 1.3.0-rc1 drupal/csv_serialization 2.0.0 drupal/ctools 3.4.0 drupal/custom_formatters 3.0.0-beta1 drupal/date_recur 3.0.0 drupal/date_recur_modular 3.0.0 drupal/devel 4.1.1 drupal/ds 3.9.0 drupal/duration_field 2.0.0 drupal/edux 8.0.5 drupal/entity_browser 2.5.0 drupal/entity_clone 1.0.0-beta4 drupal/entity_reference_exposed_filters 1.0.0-alpha3 drupal/entity_reference_revisions 1.8.0 drupal/entity_update 2.0.0-rc2 drupal/entity_usage 2.0.0-beta3 drupal/eva 2.1.0 drupal/feeds 3.0.0-alpha10 drupal/feeds_ex 1.0.0-alpha4 drupal/feeds_tamper 2.0.0-beta2 drupal/field_delimiter 1.1.0 drupal/field_group dev-3.x 9f59f95 drupal/field_group_table dev-1.x 53814f5 drupal/file_mdm 2.1.0 drupal/file_mdm_exif 2.1.0 drupal/file_mdm_font 2.1.0 drupal/filefield_sources 1.0.0-alpha4 drupal/focal_point 1.5.0 drupal/focal_point_focus 1.10.0 drupal/geocoder 3.14.0 drupal/geofield 1.20.0 drupal/image_effects dev-3.x 82c47d5 drupal/inline_entity_form 1.0.0-rc8 drupal/jquery_ui 1.4.0 drupal/jquery_ui_accordion 1.1.0 drupal/jquery_ui_datepicker 1.0.0 drupal/jquery_ui_draggable 1.2.0 drupal/jquery_ui_droppable 1.2.0 drupal/jquery_ui_slider 1.1.0 drupal/jquery_ui_touch_punch 1.0.0 drupal/leaflet 2.1.11 drupal/leaflet_geojson 1.5.0 drupal/leaflet_more_maps 2.1.0 drupal/ludwig 1.7.0 drupal/material_base 1.8.0 drupal/media_entity_pinterest 2.5.0 drupal/migrate_plus 5.1.0 drupal/migrate_source_csv 3.4.0 drupal/migrate_tools 5.0.0 drupal/multiple_selects 1.0.0 drupal/name 1.0.0-rc3 drupal/node_export 1.0.0-alpha1 drupal/office_hours 1.3.0 drupal/optimizedb 1.0.0-rc3 drupal/page_manager 4.0.0-beta6 drupal/panelbutton 1.3.0 drupal/panels 4.6.0 drupal/paragraphs 1.12.0 drupal/paragraphs_edit 2.0.0-alpha8 drupal/paragraphs_ee 1.7.0 drupal/paragraphs_features 1.11.0 drupal/pathauto 1.8.0 drupal/pcr 1.3.0 drupal/prepopulate 2.3.0 drupal/range 1.3.0 drupal/reference_table_formatter 1.1.0 drupal/require_on_publish 1.4.0 drupal/responsive_views_grid dev-1.x b27f63a drupal/rules dev-3.x 7d1833f drupal/rules_token dev-1.x ad08411 drupal/search_api 1.19.0 drupal/selective_better_exposed_filters 2.0.0-beta6 drupal/shs 1.0.0-alpha5 drupal/smtp 1.0.0 drupal/superfish 1.4.0 drupal/svg_image 1.14.0 drupal/table_field_group dev-1.x be676c6 drupal/tamper 1.0.0-alpha2 drupal/taxonomy_manager 2.0.4 drupal/telephone_formatter dev-1.x 0916a01 drupal/telephone_validation 2.3.0 drupal/term_reference_tree 1.0.0 drupal/thex 8.0.6 drupal/token 1.9.0 drupal/token_filter 1.2.0 drupal/tvi 1.0.0-rc2 drupal/typed_data 1.0.0-alpha5 drupal/vefl 3.0.0 drupal/viewfield 3.0.0-beta6 drupal/views_accordion 2.0.0 drupal/views_block_filter_block 1.0.0 drupal/views_bulk_edit 2.5.0 drupal/views_bulk_operations dev-3.x 84442e9 drupal/views_conditional 1.2.0 drupal/views_contextual_filters_or 1.2.0 drupal/views_data_export 1.0.0 drupal/views_entity_form_field 1.0.0-beta9 drupal/views_exposed_filter_blocks 1.1.0 drupal/views_field_formatter 1.13.0 drupal/views_field_view dev-1.x 91f01e9 drupal/views_fieldsets dev-3.x eea8080 drupal/views_flipped_table 1.4.0 drupal/views_geojson 1.0.0 drupal/views_templates 1.1.0 drupal/views_url_path_arguments 1.1.0 egulias/email-validator 2.1.22 enshrined/svg-sanitize 0.14.0 giggsey/libphonenumber-for-php 8.12.18 giggsey/locale 1.9 guzzlehttp/guzzle 6.5.5 guzzlehttp/promises 1.4.0 guzzlehttp/psr7 1.7.0 jetbrains/phpstorm-stubs v2019.3 laminas/laminas-diactoros 2.5.0 laminas/laminas-escaper 2.7.0 laminas/laminas-feed 2.13.0 laminas/laminas-stdlib 3.3.0 laminas/laminas-zendframework-bridge 1.1.1 league/csv 9.6.2 lsolesen/pel 0.9.10 masterminds/html5 2.7.4 mehrpadin/superfish 2.1 mtdowling/jmespath.php 2.6.0 nikic/php-parser v4.10.4 pear/archive_tar 1.4.12 pear/console_getopt v1.4.3 pear/pear-core-minimal v1.10.10 pear/pear_exception v1.0.1 phayes/geophp 1.2 phenx/php-font-lib 0.5.2 php-http/guzzle6-adapter v2.0.1 php-http/httplug 2.2.0 php-http/message 1.11.0 php-http/message-factory v1.0.2 php-http/promise 1.1.0 phpdocumentor/reflection-common 2.2.0 phpdocumentor/reflection-docblock 5.2.2 phpdocumentor/type-resolver 1.4.0 phpmailer/phpmailer v6.2.0 psr/container 1.0.0 psr/http-client 1.0.1 psr/http-factory 1.0.1 psr/http-message 1.0.1 psr/log 1.1.3 querypath/querypath 3.0.5 ralouphie/getallheaders 3.0.3 rlanvin/php-rrule v1.6.3 roave/better-reflection 4.3.0 roave/signature 1.2.0 skaught/jquery-focuspoint v1.1.3.1 softcreatr/jsonpath 0.7.2 stack/builder v1.0.6 symfony-cmf/routing 2.3.3 symfony/console v4.4.16 symfony/debug v4.4.16 symfony/dependency-injection v4.4.16 symfony/error-handler v4.4.16 symfony/event-dispatcher v4.4.16 symfony/event-dispatcher-contracts v1.1.9 symfony/http-client-contracts v2.3.1 symfony/http-foundation v4.4.16 symfony/http-kernel v4.4.16 symfony/mime v5.1.8 symfony/polyfill-ctype v1.20.0 symfony/polyfill-iconv v1.20.0 symfony/polyfill-intl-idn v1.20.0 symfony/polyfill-intl-normalizer v1.20.0 symfony/polyfill-mbstring v1.20.0 symfony/polyfill-php72 v1.22.1 symfony/polyfill-php73 v1.22.1 symfony/polyfill-php80 v1.20.0 symfony/process v4.4.16 symfony/psr-http-message-bridge v2.0.2 symfony/routing v4.4.16 symfony/serializer v4.4.16 symfony/service-contracts v2.2.0 symfony/translation v4.4.16 symfony/translation-contracts v2.3.0 symfony/validator v4.4.16 symfony/var-dumper v5.1.8 symfony/yaml v4.4.16 twig/twig v2.14.1 typo3/phar-stream-wrapper v3.1.6 webflo/drupal-finder 1.2.2 webmozart/assert 1.9.1 willdurand/geocoder 4.4.0

EDIT 2021-02-17 at 1:39 PM (complete error message + 1 line before):

[notice] Synchronized configuration: create field.field.media.pinterest_post.feeds_item. [error] Error: Call to undefined method GuzzleHttp\Utils::chooseHandler() in GuzzleHttp\choose_handler() (line 61 of C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\guzzlehttp\guzzle\src\functions.php) #0 C:\xampp\htdocs\D9e\vendor\guzzlehttp\guzzle\src\HandlerStack.php(42): GuzzleHttp\choose_handler() #1 [internal function]: GuzzleHttp\HandlerStack::create() #2 C:\xampp\htdocs\D9e\core\lib\Drupal\Component\DependencyInjection\Container.php(253): call_user_func_array(Array, Array) #3 C:\xampp\htdocs\D9e\core\lib\Drupal\Component\DependencyInjection\Container.php(447): Drupal\Component\DependencyInjection\Container->createService(Array, 'private__2i5Fjk...') #4 C:\xampp\htdocs\D9e\core\lib\Drupal\Component\DependencyInjection\Container.php(235): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) #5 C:\xampp\htdocs\D9e\core\lib\Drupal\Component\DependencyInjection\Container.php(171): Drupal\Component\DependencyInjection\Container->createService(Array, 'http_client_fac...') #6 C:\xampp\htdocs\D9e\core\lib\Drupal\Component\DependencyInjection\Container.php(432): Drupal\Component\DependencyInjection\Container->get('http_client_fac...', 1) #7 C:\xampp\htdocs\D9e\core\lib\Drupal\Component\DependencyInjection\Container.php(247): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) #8 C:\xampp\htdocs\D9e\core\lib\Drupal\Component\DependencyInjection\Container.php(171): Drupal\Component\DependencyInjection\Container->createService(Array, 'http_client') #9 C:\xampp\htdocs\D9e\modules\contrib\feeds\src\Feeds\Fetcher\HttpFetcher.php(89): Drupal\Component\DependencyInjection\Container->get('http_client') #10 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Plugin\Factory\ContainerFactory.php(21): Drupal\feeds\Feeds\Fetcher\HttpFetcher::create(Object(Drupal\Core\DependencyInjection\Container), Array, 'http', Array) #11 C:\xampp\htdocs\D9e\modules\contrib\feeds\src\Plugin\Type\FeedsAnnotationFactory.php(21): Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('http', Array) #12 C:\xampp\htdocs\D9e\core\lib\Drupal\Component\Plugin\PluginManagerBase.php(83): Drupal\feeds\Plugin\Type\FeedsAnnotationFactory->createInstance('http', Array) #13 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Plugin\DefaultSingleLazyPluginCollection.php(62): Drupal\Component\Plugin\PluginManagerBase->createInstance('http', Array) #14 C:\xampp\htdocs\D9e\core\lib\Drupal\Component\Plugin\LazyPluginCollection.php(80): Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->initializePlugin('http') #15 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Plugin\DefaultSingleLazyPluginCollection.php(83): Drupal\Component\Plugin\LazyPluginCollection->get('http') #16 C:\xampp\htdocs\D9e\modules\contrib\feeds\src\Feeds\FeedsSingleLazyPluginCollection.php(47): Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->setConfiguration(Array) #17 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Plugin\DefaultSingleLazyPluginCollection.php(99): Drupal\feeds\Feeds\FeedsSingleLazyPluginCollection->setConfiguration(Array) #18 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Plugin\DefaultSingleLazyPluginCollection.php(55): Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->addInstanceId('http', Array) #19 C:\xampp\htdocs\D9e\modules\contrib\feeds\src\Feeds\FeedsSingleLazyPluginCollection.php(38): Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->__construct(Object(Drupal\feeds\Plugin\Type\FeedsPluginManager), 'http', Array) #20 C:\xampp\htdocs\D9e\modules\contrib\feeds\src\Entity\FeedType.php(534): Drupal\feeds\Feeds\FeedsSingleLazyPluginCollection->__construct(Object(Drupal\feeds\Plugin\Type\FeedsPluginManager), 'http', Array, Object(Drupal\feeds\Entity\FeedType)) #21 C:\xampp\htdocs\D9e\modules\contrib\feeds\src\Entity\FeedType.php(449): Drupal\feeds\Entity\FeedType->getPluginCollections() #22 C:\xampp\htdocs\D9e\modules\contrib\feeds\src\Entity\FeedType.php(412): Drupal\feeds\Entity\FeedType->getPlugin('fetcher') #23 C:\xampp\htdocs\D9e\modules\contrib\feeds\src\Entity\FeedType.php(562): Drupal\feeds\Entity\FeedType->getPlugins() #24 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Entity\EntityStorageBase.php(494): Drupal\feeds\Entity\FeedType->preSave(Object(Drupal\Core\Config\Entity\ConfigEntityStorage)) #25 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Entity\EntityStorageBase.php(449): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\feeds\Entity\FeedType)) #26 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Config\Entity\ConfigEntityStorage.php(263): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\feeds\Entity\FeedType)) #27 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Entity\EntityBase.php(339): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\feeds\Entity\FeedType)) #28 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Config\Entity\ConfigEntityBase.php(591): Drupal\Core\Entity\EntityBase->save() #29 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Config\Entity\ConfigEntityStorage.php(364): Drupal\Core\Config\Entity\ConfigEntityBase->save() #30 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Config\ConfigImporter.php(990): Drupal\Core\Config\Entity\ConfigEntityStorage->importCreate('feeds.feed_type...', Object(Drupal\Core\Config\Config), Object(Drupal\Core\Config\Config)) #31 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Config\ConfigImporter.php(776): Drupal\Core\Config\ConfigImporter->importInvokeOwner('', 'create', 'feeds.feed_type...') #32 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Config\ConfigImporter.php(603): Drupal\Core\Config\ConfigImporter->processConfiguration('', 'create', 'feeds.feed_type...') #33 C:\xampp\htdocs\D9e\core\lib\Drupal\Core\Config\ConfigImporter.php(507): Drupal\Core\Config\ConfigImporter->processConfigurations(Array) #34 C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\drush\drush\src\Drupal\Commands\config\ConfigImportCommands.php(335): Drupal\Core\Config\ConfigImporter->doSyncStep('processConfigur...', Array) #35 C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\drush\drush\includes\drush.inc(206): Drush\Drupal\Commands\config\ConfigImportCommands->doImport(Object(Drupal\Core\Config\StorageComparer)) #36 C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\drush\drush\includes\drush.inc(197): drush_call_user_func_array(Array, Array) #37 C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\drush\drush\src\Drupal\Commands\config\ConfigImportCommands.php(306): drush_op(Array, Object(Drupal\Core\Config\StorageComparer)) #38 [internal function]: Drush\Drupal\Commands\config\ConfigImportCommands->import(NULL, Array) #39 C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\consolidation\annotated-command\src\CommandProcessor.php(257): call_user_func_array(Array, Array) #40 C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\consolidation\annotated-command\src\CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData)) #41 C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\consolidation\annotated-command\src\CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData)) #42 C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\consolidation\annotated-command\src\AnnotatedCommand.php(311): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData)) #43 C:\xampp\htdocs\D9e\vendor\symfony\console\Command\Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #44 C:\xampp\htdocs\D9e\vendor\symfony\console\Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #45 C:\xampp\htdocs\D9e\vendor\symfony\console\Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #46 C:\xampp\htdocs\D9e\vendor\symfony\console\Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #47 C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\drush\drush\src\Runtime\Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #48 C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\drush\drush\src\Runtime\Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput)) #49 C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\drush\drush\drush.php(72): Drush\Runtime\Runtime->run(Array) #50 C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\drush\drush\drush(4): require('C:\\Users\\Clemen...') #51 {main}. Error: Call to undefined method GuzzleHttp\Utils::chooseHandler() in C:\Users\Clement\AppData\Roaming\Composer\global\drush\drush\vendor\guzzlehttp\guzzle\src\functions.php on line 61 #0 C:\xampp\htdocs\D9e\vendor\guzzlehttp\guzzle\src\HandlerStack.php(42): GuzzleHttp\choose_handler()
Clément BK

Views math expression or Computed field to find date difference in views

5 hours 32 minutes ago

I have two content type, Bill (Type1) and Cash Receipts (Type2), Type2 referencing Type1 when cash is received.

In Type1 I have date field called (Bill Issue date), and Type2 I have date field cash receipt date.

So I want to calculate, different between those two dates. I was trying by creating views with two date (by entity reference relationship), then subtract two filed with math expression field, but it return zero.

Actually, I have no idea whether I was wrong or Its not possible to calculate different between dates with views math expression field?

I think, it can be done with Computed Field, I did one within same content type, but I don’t know how to access a field from different content type, please help.

Code that I was used to calculate date for same content type, but how I can access a field from other content type?

If the Machine name of your date-field is 'field_example_date', then the Computed Code (PHP) would be

$startdate = $entity->field_example_date['und'][0]['value']; // Value of start-date $enddate = $entity->field_example_date['und'][0]['value2']; // Value of end-date $datediff = strtotime($enddate) - strtotime($startdate); /* The PHP Function STRTOTIME parses the english textual datetime description * into a Unix timestamp */ $num_leaves = $datediff/(60*60*24); /* Since we need the number of days IN-BETWEEN, * we divide the resultant difference by 60*60*24 . * * Incase of counting no.of days "FROM" to "TO" days, add 1 to the above result. * $num_leaves = $datediff/(60*60*24) + 1; */ $entity_field[0]['value'] = $num_leaves; The Display Code (PHP) will have $display_output = $entity_field_item['value'];
Md. Jakaria

Exposed filters in Block for Page View do not filter results

7 hours 38 minutes ago

I have below content types with following related fields setup in a Drupal7 setup.

Activity Fields: Name, Body and Image.

Event Fields:

  • Date
  • Location: Term Reference for Taxonomy Location
  • Activity : Term Reference for Taxonomy Location
  • Organiser: Entity Reference for Organizer node (as 1 event will have only 1 organizer)

Organiser Fields:

  • Location: Term reference for Location taxonomy
  • Activity: Entity Reference for node Activity.

I have setup a Page View named Experience, with Listing of Events on right sidebar and on left sidebar i want to display the Filters.

I have managed to Expose the filter with BEF, however these filters don't give any result after changing value. Though they are set to Use Ajax.

Also other filters like Organiser and Location are autocomplete fields, these fields do not show-up any value on entering text.

Kindly help

UPDATE: Here's the SQL Query

SELECT node.nid AS nid, node.title AS node_title, node.created AS node_created, 'node' AS field_data_field_event_date_node_entity_type, 'node' AS field_data_field_event_image_node_entity_type, 'node' AS field_data_field_event_location_node_entity_type, 'node' AS field_data_field_event_amount_node_entity_type FROM {node} node LEFT JOIN {field_data_field_event_club} field_data_field_event_club ON node.nid = field_data_field_event_club.entity_id AND (field_data_field_event_club.entity_type = 'node' AND field_data_field_event_club.deleted = '0') WHERE (( (node.status = '1') AND (node.type IN ('event')) AND (field_data_field_event_club.field_event_club_target_id IS NOT NULL ) )) ORDER BY node_created DESC LIMIT 12 OFFSET 0
SNaushadS

How to translate field collection which has unlimited values?

9 hours 41 minutes ago

My configuration: latest dev entity translation and field collection module + patch.

I tried:

1. Entity translation is on just for taxonomy term and node, but not for field collection (it triggers notice: not translatable because of valid base path...) I have taxonomy term with field collection (unlimited value). In FC field there are just two fields that needs to be translated. FC and fields inside FC have set "enable field translation by users".

With these settings I can create a term, set values to FC fields on default language and save. Then I can translate and set values to FC fields for second language and save. All good when checking if it did saved 2 different values - each for own language. Then I create view which is used on panels and is using termID as context filter. View has relationship on FC field and I added FC fields to show. What happens: on view when I preview with term ID (context filter) I get correct result for the language in URL (en/admin/structure/views..). Also when I change URL to another language prefix I get translated fields in that language. But translated fields don't show on actual term pages.

2. Beside what I described in 1, I also enable entity translation for field collection. Notice about valid base path is still there, but I applied patch and i don't get errors when adding or translating FC.

With this configuration I create fresh FC with new fields and enable field translation for all of them. On term I set some values for FC fields and save it. I repeat this step when translating. But when I save translations and open them they are empty. On the next fill they remain. But the view for this configuration is still not showing right values for selected languages.

Does anyone have any hint what I am doing wrong? I really need to fix this issue on my site and I am short on time.

What I need is to translate FC field (and it's fields) which can have unlimited values.
frikovc

Migration of content with an UI

10 hours 40 minutes ago

My goal is to import data of customers from a csv file to my custom entity. For that I wrote a migration with the migrate_source_csv module as source plugin. This works fine, but the problem is, that the import is just possible with drush. But it should work with an UI where a user can upload a file and run the import.

Is there any way to execute the import without drush?

Chris4783

How to get Final SQL query when using Views?

11 hours 36 minutes ago

How do I get complete SQL query from Views, the one I could run in mysql directly.For example biggest stumbling block is fields part. Like below

SELECT users_node.uid AS users_node_uid, node.created AS node_created, node.nid AS nid, users_node.mail AS users_node_mail, 'user' AS field_data_field_first_name_user_entity_type, 'user' AS field_data_field_last_name_user_entity_type, 'node' AS field_data_field_purchase_date_node_entity_type, 'node' AS field_data_field_serial_number_node_entity_type FROM {node} node LEFT JOIN {users} users_node ON node.uid = users_node.uid WHERE (( (node.status = '1') AND (node.type IN ('product_registration')) )) ORDER BY node_created DESC LIMIT 50 OFFSET 0

this lines are problematic field_data_field_first_name_user_entity_type, field_data_field_last_name_user_entity_type etc

They are not real fields in DB, they somehow get rewritten somewhere, but I can't find where and how. How to get the FINAL query to DB in drupal when using views?

p.s. in image, you can see what I get for those fields in phpmyadmin if I run query. Not really useful.

Blissful

List nodes of children using taxonomy_select_nodes

12 hours 30 minutes ago

I want to list nodes from children terms using or editing taxonomy_select_nodes function. Actually I added these few lines but I get an infinite loop or slow response:

function taxonomy_select_nodes_ext($tid, $pager = TRUE, $limit = FALSE, $order = array('t.sticky' => 'DESC', 't.created' => 'DESC'),$promote) { if (!variable_get('taxonomy_maintain_index_table', TRUE)) { return array(); } $query = db_select('taxonomy_index', 't'); $query->addTag('node_access'); $query->condition('tid', $tid); if ($pager) { $count_query = clone $query; $count_query->addExpression('COUNT(t.nid)'); $query = $query->extend('PagerDefault'); if ($limit !== FALSE) { $query = $query->limit($limit); } $query->setCountQuery($count_query); } else { if ($limit !== FALSE) { $query->range(0, $limit); } } $query->addField('t', 'nid'); $query->addField('t', 'tid'); // This block of code is the custom code I added. //SELECT only promoted article if($promote==1){ $query->join('node', 'no', 'no.nid = t.nid'); $query->condition('promote', 1); } $taxonomies=array(); $taxonomies = taxonomy_get_children($tid); $taxonomies[]=$tid; $query->condition('t.tid', $taxonomies,'IN'); foreach ($order as $field => $direction) { $query->orderBy($field, $direction); // ORDER BY fields need to be loaded too, assume they are in the form // table_alias.name list($table_alias, $name) = explode('.', $field); $query->addField($table_alias, $name); } return $query->execute()->fetchCol(); }
hanzouti

Infinite Redirect Loop with PURL and spaces_og

13 hours 40 minutes ago

I created a calendar feature for organic groups, and tried to enable it in a group with spaces_og. The page refreshes saying changes have been saved but the feature is still disabled. In the logs, there is a message that purl prevented a redirect loop.

I realize spaces is still in dev with d7. Is this a known issue? Did I do something wrong when creating my feature, or is there a better way to create features for use in organic groups?

Arosboro
Checked
1 hour 57 minutes ago
most recent 30 from drupal.stackexchange.com
Subscribe to Drupal StackExchange feed