Skip to main content
7 events
when toggle format what by license comment
Mar 5, 2019 at 13:21 comment added berramou ok where did you put that come, which hook , which file ?
Mar 5, 2019 at 11:44 comment added Rich Stevens Drupal 7.I also made it this far now: <?php $query=new EntityFieldQuery(); $query->entityCondition('entity_type', 'school_objects') ->entityCondition('bundle', 'homepage'); $result=$query->execute(); if (!empty($result['school_objects'])) { $nids=array_keys($result['school_objects']); $entity_testimonails=entity_load('school_objects', $nids); foreach($entity_testimonails as $testimonails) { $wrapper=entity_metadata_wrapper('school_objects', $testimonails->id, array('bundle' => 'homepage'));}}?> <!--html here--> <h1><?php echo ($wrapper->field_hero_banners->value());?></h1> .
Mar 5, 2019 at 10:53 comment added berramou I think the sample of code in the question for drupal 7, and your code snippet for drupal 8, @Rich Stevens which version of drupal you use ?
Mar 5, 2019 at 9:15 comment added Rich Stevens No idea what a controller class or a twig is. Was trying to adapt some existing php that is on a tpl file. But seems I am years away from that at the moment. Thanks for your help, this might help someone on a higher level than me.
Mar 5, 2019 at 8:59 comment added theuni well, this code should be part of a Controller class or something similar. In a drupal way I'd add this code to a controller, prepare the array of values for a twig template, add a custom twig template with a loop to print those values between your html tags. You can't just put this code in a html file. That means this is part of a custom module. I could help you with that, but I doubt this would help you, given your little knowledge of php/drupal?
Mar 5, 2019 at 8:54 comment added Rich Stevens This just breaks the page. Also this bit "\Drupal::entityTypeManager()" I tried instead of the other line and that also breaks the page. Do I add most of this code to the top of the page, then the loop bit between my html tags? I am total novice with php.
Mar 5, 2019 at 7:29 history answered theuni CC BY-SA 4.0