By zorax on
Hi,
I use
$view = views_embed_view('export_emargement','page_1',$journee,$region,$produit);it works well, but If I don't want to specify $region the view does'nt works.
Im my view admin if I set argument like this 797/62/24 it works
If I try 797/all/24 it works too!every data are displayed
In my code i try this, but it can't be parsed
$args = array($journee.',"all",'.$produit);
or
$args = array($journee.',all,'.$produit);
$view = views_embed_view('export_emargement','page_1',$args);
Comments
Arg list
Hi Zorax,
You need to set 3 args .. try
$args = array ('797' , 'all' , '24');
If that works (which it should) then change to
$arg1 = <the value you want -- ie 797>
$arg2 = <Value of the region -- ie all>
$arg3 = <the value you want -- ie 24>
$args = array($arg1 , $arg2, $arg3);
Hi, thanks for your answer.
Hi, thanks for your answer.
I try
but it doesn't works too...
www.almedestudio.com
Can you share the Error
Can you share the Error message?
Warning: array_flip(): Can
Warning: array_flip(): Can only flip STRING and INTEGER values! in /home/almedest/public_html/dev/mais/core/lib/Drupal/Core/Entity/EntityStorageBase.php on line 264
Warning: array_flip(): Can only flip STRING and INTEGER values! in /home/almedest/public_html/dev/mais/core/lib/Drupal/Core/Entity/EntityStorageBase.php on line 264
Notice: Array to string conversion in /home/almedest/public_html/dev/mais/core/lib/Drupal/Core/Entity/EntityStorageBase.php on line 131
Warning: html_entity_decode() expects parameter 1 to be string, array given in /home/almedest/public_html/dev/mais/core/lib/Drupal/Component/Utility/Html.php on line 386
Le site Web a rencontré une erreur inattendue. Veuillez essayer de nouveau plus tard.
InvalidArgumentException: Placeholders must have a trailing [] if they are to be expanded with an array of values. in Drupal\Core\Database\Connection->expandArguments() (line 735 of core/lib/Drupal/Core/Database/Connection.php).
Drupal\Core\Database\Connection->query('SELECT inscription_field_data.langcode AS inscription_field_data_langcode, commerce_product_field_data_inscription_field_data.langcode AS commerce_product_field_data_inscription_field_data_langcode, annuaire_field_data_inscription_field_data.langcode AS annuaire_field_data_inscription_field_data_langcode, commerce_product_field_data_inscription_field_data__commerce_product__field_type_inscription.field_type_inscription_target_id AS commerce_product_field_data_inscription_field_data__commerce, annuaire_field_data_inscription_field_data.region AS annuaire_field_data_inscription_field_data_region, inscription_field_data.id AS id, annuaire_field_data_inscription_field_data.id AS annuaire_field_data_inscription_field_data_id, commerce_product_field_data_inscription_field_data.product_id AS commerce_product_field_data_inscription_field_data_product_i, taxonomy_term_field_data_annuaire_field_data.tid AS taxonomy_term_field_data_annuaire_field_data_tid, node_field_data_commerce_product__field_formation.nid AS node_field_data_commerce_product__field_formation_nid FROM {inscription_field_data} inscription_field_data LEFT JOIN {annuaire_field_data} annuaire_field_data_inscription_field_data ON inscription_field_data.annuaire = annuaire_field_data_inscription_field_data.id LEFT JOIN {commerce_product_field_data} commerce_product_field_data_inscription_field_data ON inscription_field_data.produit_inscription = commerce_product_field_data_inscription_field_data.product_id LEFT JOIN {taxonomy_term_field_data} taxonomy_term_field_data_annuaire_field_data ON annuaire_field_data_inscription_field_data.region = taxonomy_term_field_data_annuaire_field_data.tid LEFT JOIN {commerce_product__field_formation} commerce_product_field_data_inscription_field_data__commerce_product__field_formation ON commerce_product_field_data_inscription_field_data.product_id = commerce_product_field_data_inscription_field_data__commerce_product__field_formation.entity_id AND (commerce_product_field_data_inscription_field_data__commerce_product__field_formation.deleted = :views_join_condition_0 AND commerce_product_field_data_inscription_field_data__commerce_product__field_formation.langcode = commerce_product_field_data_inscription_field_data.langcode) LEFT JOIN {node_field_data} node_field_data_commerce_product__field_formation ON commerce_product_field_data_inscription_field_data__commerce_product__field_formation.field_formation_target_id = node_field_data_commerce_product__field_formation.nid LEFT JOIN {commerce_product__field_type_inscription} commerce_product_field_data_inscription_field_data__commerce_product__field_type_inscription ON commerce_product_field_data_inscription_field_data.product_id = commerce_product_field_data_inscription_field_data__commerce_product__field_type_inscription.entity_id AND commerce_product_field_data_inscription_field_data__commerce_product__field_type_inscription.deleted = :views_join_condition_2 WHERE (node_field_data_commerce_product__field_formation.nid = :node_field_data_nid) ORDER BY commerce_product_field_data_inscription_field_data__commerce ASC, annuaire_field_data_inscription_field_data_region ASC', Array, Array) (Line: 358) Drupal\Core\Database\Driver\mysql\Connection->query('SELECT inscription_field_data.langcode AS inscription_field_data_langcode, commerce_product_field_data_inscription_field_data.langcode AS commerce_product_field_data_inscription_field_data_langcode, annuaire_field_data_inscription_field_data.langcode AS annuaire_field_data_inscription_field_data_langcode, commerce_product_field_data_inscription_field_data__commerce_product__field_type_inscription.field_type_inscription_target_id AS commerce_product_field_data_inscription_field_data__commerce, annuaire_field_data_inscription_field_data.region AS annuaire_field_data_inscription_field_data_region, inscription_field_data.id AS id, annuaire_field_data_inscription_field_data.id AS annuaire_field_data_inscription_field_data_id, commerce_product_field_data_inscription_field_data.product_id AS commerce_product_field_data_inscription_field_data_product_i, taxonomy_term_field_data_annuaire_field_data.tid AS taxonomy_term_field_data_annuaire_field_data_tid, node_field_data_commerce_product__field_formation.nid AS node_field_data_commerce_product__field_formation_nid FROM {inscription_field_data} inscription_field_data LEFT JOIN {annuaire_field_data} annuaire_field_data_inscription_field_data ON inscription_field_data.annuaire = annuaire_field_data_inscription_field_data.id LEFT JOIN {commerce_product_field_data} commerce_product_field_data_inscription_field_data ON inscription_field_data.produit_inscription = commerce_product_field_data_inscription_field_data.product_id LEFT JOIN {taxonomy_term_field_data} taxonomy_term_field_data_annuaire_field_data ON annuaire_field_data_inscription_field_data.region = taxonomy_term_field_data_annuaire_field_data.tid LEFT JOIN {commerce_product__field_formation} commerce_product_field_data_inscription_field_data__commerce_product__field_formation ON commerce_product_field_data_inscription_field_data.product_id = commerce_product_field_data_inscription_field_data__commerce_product__field_formation.entity_id AND (commerce_product_field_data_inscription_field_data__commerce_product__field_formation.deleted = :views_join_condition_0 AND commerce_product_field_data_inscription_field_data__commerce_product__field_formation.langcode = commerce_product_field_data_inscription_field_data.langcode) LEFT JOIN {node_field_data} node_field_data_commerce_product__field_formation ON commerce_product_field_data_inscription_field_data__commerce_product__field_formation.field_formation_target_id = node_field_data_commerce_product__field_formation.nid LEFT JOIN {commerce_product__field_type_inscription} commerce_product_field_data_inscription_field_data__commerce_product__field_type_inscription ON commerce_product_field_data_inscription_field_data.product_id = commerce_product_field_data_inscription_field_data__commerce_product__field_type_inscription.entity_id AND commerce_product_field_data_inscription_field_data__commerce_product__field_type_inscription.deleted = :views_join_condition_2 WHERE (node_field_data_commerce_product__field_formation.nid = :node_field_data_nid) ORDER BY commerce_product_field_data_inscription_field_data__commerce ASC, annuaire_field_data_inscription_field_data_region ASC', Array, Array) (Line: 510) Drupal\Core\Database\Query\Select->execute() (Line: 1521) Drupal\views\Plugin\views\query\Sql->execute(Object) (Line: 1426) Drupal\views\ViewExecutable->execute(NULL) (Line: 1454) Drupal\views\ViewExecutable->render() (Line: 2402) Drupal\views\Plugin\views\display\DisplayPluginBase->preview() (Line: 1662) Drupal\views\ViewExecutable->preview('page_1', Array) (Line: 62) Drupal\views\Element\View::preRenderViewElement(Array) call_user_func(Array, Array) (Line: 378) Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 195) Drupal\Core\Render\Renderer->render(Array, ) (Line: 895) drupal_render(Array) (Line: 179) Drupal\mais\Form\exportForm->submitForm(Array, Object) call_user_func_array(Array, Array) (Line: 111) Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 51) Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 590) Drupal\Core\Form\FormBuilder->processForm('mais_export_form', Array, Object) (Line: 319) Drupal\Core\Form\FormBuilder->buildForm('mais_export_form', Object) (Line: 93) Drupal\Core\Controller\FormController->getContentResult(Object, Object) call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)www.almedestudio.com
Correct way to pass args
Hi Zorax,
Can you try
aleady tested it works
aleady tested it works perfectly. The problem occured when I need all data passed by 'all' to the argument of the view...
www.almedestudio.com