Alter a view. Edit view result programmatically | Drupal 8

Alter a view. Edit view result programmatically

Submitted by editor on Fri, 09/30/2016 - 11:16
Question

How to Edit a view result programmatically ?

Example:

function MYMODULE_views_pre_render(&$view) {
  if ($view->name == 'view_myviewname') {
    $result = $view->result;
    foreach ($result as $i => $row) {

      $view->result[$i]->field_field_myfieldtext[0]['rendered']['#markup'] = "The new text";
    }
  }
}

Comments

hess (not verified)

Tue, 10/18/2016 - 13:31

How can i edit a view? I mean where should i add this program? I am really new to D8. trying to learn it.

Ruchira (not verified)

Mon, 10/09/2017 - 15:49

If view having empty result then no debug working in views_pre_render(&$view). So waht was another solution to handle no result message programmatically. 

cartier jewelry
longchamp bag
goyard bag
moncler jacket womens
christian louboutin
kyrie irving shoes
ralph lauren outlet
Yeezy
ralph lauren shirts
adidas yeezy
oakley glasses
air max 90
yeezy boost
pandora
pandora Charms
jimmy choo heels
salomon shoes
ferragamo shoes men
air max 270
nike air max
mont blanc pens
new balance
Pandora Bracelet
nike air max 97
birkenstock sandals
burberry
nmd
fitflop shoes
salomon speedcross 3
mbt
kate spade handbags
ugg slippers
nike air max 95
red bottoms
ray ban sunglasses
pandora bracelet
mulberry sale
chrome hearts jewelry
nike air max 97
red bottoms
nike air max
pandora rings
pandora necklace
ultra boost uncaged
adidas superstar mens
nike air max 90
nike vapormax
adidas nmd r1
pandora charms
kate spade wallet
ed hardy clothing
balenciaga bag
yeezy boost 350 v2
pandora charms
moncler
supreme clothing
asics
moncler jacket
lebron 15
supreme clothing
longchamp bag
ralph lauren polo shirts
asics womens shoes
kyrie irving
kate spade bags
lebron 15
kevin durant shoes
nike air max
adidas
celine handbags
mk handbags
north face
jordan 11
mcm handbags
swarovski bracelet
hermes
kd 9
rihanna puma shoes
salvatore ferragamo
christian louboutin
salomon
ugg boots
pandora earrings
coach purses
air max 97
fitflop shoes
Hermes Handbags
chrome hearts t shirt
harden vol 1
yeezy boost 350
ray ban eyeglasses
moncler jacket
stephen curry
yeezy boost 350
skechers women
pandora charms
space jam 11
nike air max 90
mcm
ray ban sunglasses
true religion jeans for women
nike air vapormax
north face vest
adidas yeezy
oakley eyeglasses
jordan 11 space jam
true religion
nike air max 270
huarache
moncler coat
nike air max
Salomon
prada
pandora bracelet
nike air max 97
jordan 11
goyard
balenciaga
nike air vapormax
ugg
moncler jacket
air max 90
adidas originals ultra boost
nike huarache
birkenstock sale
michael kors
nike air max 95
fitflop
mulberry sale
skechers boots
lacoste shirts
ray ban wayfarer
uggs for men
valentino heels
yeezy shoes
bulgari jewelry
fitflop sandals
air max 95 black
air jordan
adidas nmd womens
pandora jewelry official site
burberry bags
swarovski necklace
ecco sandals
chrome hearts clothing
burberry scarf
jordan retro 11
kd shoes
skechers
under armour shoes
adidas originals nmd
nike vapormax
prada wallet
polo ralph lauren
under armour stephen curry
barbour
barbour coats
coach handbags

Add new comment