okay so this is Danny play thank you for
coming out to make it it's always
exciting to be here and to present with
everyone make sure that you can grab the
slides at the link at the top follow
along so a little bit about me
my name is leilani Todd I live here in
Chicago
I usually tweet very rarely but I do
about there just in case I work for a
company called hermetic we are we're a
distributed team so we have team members
all around the world so check this out
and now let's just dive right into the
subject matter today
taming Twitter so in my own experience
of using twitting the past few years
with Drupal 8 there's some common
problems that I've experienced and
they're really frustrating and when I
look at what Stack Exchange or sample
overflow if you look at all the problems
which I did in the past few weeks to see
and try to distill them into the same
sort of categories there's no common
categories so the first one is that your
changes just don't appear if you try to
print something on the screen we're
twiggy and it doesn't appear at all the
second one is that when you call a
variable in a quick template your output
just isn't what you expected you try to
call in the field and it doesn't appear
and the third and fourth ones are that
your site is unavailable or that is just
unresponsive at all so you're unable to
actually work with this anymore
so for the talk today we're going to
talk about how to address those four
common problems so first we're going to
talk about how to debug Twigg second
we're going to talk about the values
that you can find within your template
Derek about resolving any sort of PHP
errors and how to avoid them fourth the
dreaded white screen of death when your
site becomes unresponsive and finally
when something is too difficult to solve
by yourself and where to go over that's
where public so first debugging Twigg
let's talk about our debug setup so
where I services to Hamel file inside
slash default we are able to change some
values that we can make sure that we can
debug twig and have some sort of tools
available to us so under tweak that
config we have to make sure that debug
is set to true that I'll remove love
also set to true and caching a set to
false
all of these things by default if you
were to copy the default services that
ml family name it will be the opposite
of use now for a production site you
want to make sure that it's the opposite
of these but when you're locally
developing or working on a development
site you're trying to figure out what's
going on with your templates make sure
that these are set I've seen here
now the output when you expect something
look like a chrome inspector with those
value saying your services that yeah
well probably look something like this
you'll be able to see the sort of files
and suggestions that Drupal and tweak
are looking through in terms of what
file or what tweak file is being called
in and the kind of files that you have
available to you so in this case we can
see that it gets a specific as noted
file with the node IDs we can alter a
specific note or you can use a note type
so in our case we're using the basic
page template we have no - - page
available to us here and finally we have
our basic note that you should see on
that twig files so services I handle is
really helpful to just know when you're
working with a lot of different
templates and different fields and
things are being called in you'll have a
better idea of what tweak files were
working to address the issue that you
want to address available to us also is
the dump file with xx so here we're just
calling dump on content field in your
header so here we're just going to be
calling in our field header and if we
want to look at what that looks like
when it's printed out by default we just
get this array or a bunch of different
keys then we can call in these different
keys we can
like them in order to pull in the values
and tweak that we're trying to find to
us now another tool that's really useful
and pretty common is to use develop the
milk comes with a bunch of great things
developed in and of itself and there's a
module in it called eval kids this
allows us to use the camp function which
we call them the same way that we use a
dumb function so here we're calling it a
hint on classes which is part of the
page
that pretty much HTML that twig file and
it outputs up to the page in a similar
way as our dumb function except that we
have you sort of nested arrays that we
can dig into and so what gets loaded is
instead of having that ugly sort of a
dump array which is just a bunch of keys
you can actually go and find your key
selected and find more details about
what you kind of find out there now when
using kin I don't know if people have
experience to hear but in my own
experience I found that it's not as
performative as dump and that there's
usually like a bunch of problems
sometimes you're like you trying to do
Kent on a file or a variable and like
things just like the site doesn't load
your memory gets timed out so there's
another tool that I just found out about
in this past year which is it takes the
best of both rows so you have the
ability to use dump which usually is
pretty consistent in terms of its narrow
usage and you also get a nice output
like this where you can click through
and find the values you're trying to
find within a nested array in that tool
is this contributing module called twig
bard number
so here you have the ability to call
your tweak variable and to cycle through
it and find the values that you want to
do just by going through the nested
arrays to find the specific values that
you want to find so now that we have
these tools is there the tools we'll be
talking about today let's talk about how
we actually find the values specific
internal so we're going to talk about
first is just like the generic sort of
like a generic feel when you're working
with a node template or an entity
template of any sort so popular one is
using nodes you're using taxonomy terms
contributed module called paragraphs is
becoming more common these are the sort
of entities that this applies to so you
have when you work with a twig template
of content object within that content
object you have all the fields that are
on that entity so we're using dot
notation here so content dot field name
in order to call our field and to output
this sort of markup and data that we
have so in terms of like a vanilla sort
of approach this applies in most cases
just calling content got your field name
now we're going to look at a few
different examples that are a bit
different and then just the content dot
field name for example
and you try to find our links if we were
to have it feel called pit lane that's
just a generic Drupal field that we use
for links when we call that it outputs
both are linked and the text where the
title associated with that link which in
a lot of cases may be and that's what
you want you just want an anchor tag
with a link and if you want to add a
class or you want to do something to
those links or to modify them it
requires a bit more effort so here we
want to add a button class so that we
can you know present our link in a nice
way that looks like a button now if
we're digits we call content I feel
underscore link we wouldn't have access
to this so we can split that up by
accessing an array within there that has
Baylor l key and the title key so we can
split certain objects with dead twig and
then maybe like that how we see fit now
taking this long now this is also very
specific so when you're working with
twig usually you use dot notation for
all feein so content dot field link dot
an entity or dot image or something but
for fields it's specific to fields where
you would use the array notation here to
get within there now to find this this
is done by using twig and the debug
functions to find the use cases for this
this is a very prominent use case now
similarly if you want to work with our
files
we have to make sure we're calling the
file URL it's in order here we're just
ensuring that in our template we are
separating out the file URL value and
calling the file URL function on it to
make sure it is parsed correctly so the
notation here we're still using dot
notation we're calling node which is an
entity dot field value to get or sorry
excuse me field file to get our file
field we're calling entity to grab the
file
entity that's associated with our file
because for example in trupo if you're
using a standard Drupal file or image
field
those are entities or objects that are
stored on the fields we slice we chain
these sort of dog notations from node
dot file field pile to the entity and on
that entity we can get the URI and
within there we wrap the value of the
URI which allows us to translate it into
a URL
so with images it's essentially the same
sort of story we call our image field
we've grabbed the entity on there
we grab the URI and we turn that into a
value but with images it's a little bit
different in that images have the image
file which is just like a file but then
there's also titles that you can
associate with images
there's also alt text for accessibility
that you can use and if we want to do
special things with this
so in particular a really good use case
for using this sort of approach is when
you are working with lazy loaders
sometimes they require different
attributes within be HTML and in order
to pass in what a wants we're gonna have
to dig a bit deeper so we have our
generic sort of image approach with
turning my image into a doorbell they're
grabbing like an all field here this is
really particular with how we do it so
you think that the image field and the
alt tag or the title that's associated
with it would be on the image itself
that seems to be I mean that's what I
thought for a long time so I finally
discovered that the alt and the text
associated with it is on the image field
and not the image file so that's a clear
distinction of how we would go dig
deeper into the values that are
available to us within an image field in
order to grab content from there
okay we're going to talk really a little
bit about the without filter that tweak
has available to us so in a lot of
different templates if you were to look
at the default implementations you would
see that there's a content variable
there and it doesn't usually have any
sort of dot notation that you know links
to fields or have anything associated
with it usually to this content and for
the most part that could be good if you
just want to output a lot of different
fields in how you configure them within
Drupal site builders sort of
configurations of the node or a
paragraph or an entity type but we have
some use cases where you want to include
all the content except for one you want
to separate one of those fields out now
using the without filter within twig we
can pass in the Machine name of a field
to make sure that that field gets
excluded from the render and so we can
use that field name somewhere else so
here we are just printing all of our
content within our main div and outside
of that in a sidebar we're gonna put in
our field name so here we can start to
put the pieces together of how we would
separate out different pieces of content
that are out put in our twig templates
now there's a few use cases where we
have these two different variables
within a tweaked template that are a bit
different than how you usually approach
an entity type like a node or a taxonomy
term or a paragraph for example here we
have items and items is usually a field
for example a list filled with text
letters multiple items multiple
different values associated with it now
in this one in particular we're talking
about a field that is a it could either
be an integer list field you can either
be a string on the collection so we're
calling our field machine name whatever
it's called Silver's that both field -
lists based on that swing and we're
calling our
we're calling for loop on the items to
make sure that we are iterating through
each and every item and then on each
item in and of itself there is content
and content is attached to that specific
field item to output each of those
things now how is this valuable like
this if you open up a field within
Drupal just look at the default
implementation you're looking exactly
like this but if you wanted to do more
with it let's say that you've had let's
say that you wanted to loop through your
items and apply different classes those
things are available to us and it's
outside of the scope of this talk in
particular since there is a loop index
within twig that we can go through and
apply different things but within this
context using debug functions you'll be
able to find what's within the content
variable to explore within their field
specifically ROS works in almost the
same sort of way so Buse is a common
tool that we all use when building sets
with Drupal and within the ROS object we
have on grow and within there there's
content now that content is usually
defined by the sort of configurations
that we have set up for our views
whether we're calling in fields when we
set up our views or if we're calling it
out the alone to help it out different
node types
[Music]
so digging deeper into the content
variables is something that it took me a
while to figure out and to understand
that you know content isn't this like
the content variable is available
everywhere but each implementation is
slightly different so you think debug
functions will be really helpful in
terms of finding out and they're
standing exactly what you need to do to
output the content that you want so
let's put all of these together take a
look at an example of a field called
neighborhoods that just has some
neighborhoods of Chicago Street the
neighborhoods in Chicago so in our row
we're going to exclude dining roads
field because we want to do something
specific to it and here this might seem
super intimidating in terms of what's
available within the content variable so
if we were just to develop step through
it we have Rose which is all the
different pieces of content available to
us within the view within the content of
a specific room we have a view key that
gives us access to a few different
things so teaching in the style plug-in
and pulling the render tokens
[Music]
let's start it let's start at the step
tikka let's take a little bit of a step
back in terms of what's up what all is
going here with this view okay so
so the content that we have available to
us is a part of this view key and what
we're going to be passing into it is
going to be the tweed markup that that
feel that then that views is going to be
outputting so in the end we're going to
be calling our field underscore
neighborhoods as a variable as we see a
bit at the very bottom before the end
floor so this is within the same it's
the same notation as if you were working
directly within a twig template so you
have to have the double curly braces on
both sides it's a bit different because
I mean with a lot of how we would work
with these sort of things you'd think
that you just pass in the name of the
field in and of itself without the curly
braces braces but that doesn't work
since we're calling render tokens before
that now the loop index just means that
we dot index zero means what key what
number of well you're outputting so it
starts at zero one two three
all it's doing is just making sure that
Duty is iterating through each and every
row available to us and as the stop
plugin is what allows us to have access
to this sort of content
now there's a really handy contributed
module so the way that we talked about
everything so far is just if you
download Drupal 8 install it out of the
box you know work with some of the
default things or or check out any of
those sort of things that's how you'd
approach it there's a contributed model
Cox played on your score field down here
and it gives us these very specific sort
of filters where instead of having to
dig through the content variable instead
of having to dig through these sort
things we can pass in filters on these
fields in order to output the content
that we want so we have field label
which it's all very straightforward in
terms of what it's doing it returns a
label the value just returns your field
value without any of the wrappers
without any of the sort of dibs or
things that are associated with them
yeah field raw which is just like this
straight raw value that's being stored
within your database and then we have a
special one called field targets entity
now this returns your referenced object
of a field
now keep this target to t1 fine because
it will come in useful in the next few
slides so we're talking about our
neighborhoods field once again using
twig field value we can get the label
and we can get that value and get the
output that we desire so you can see the
neighborhood's we save you we see that
way Lincoln Park it's very straight
forward in terms of doing that it's a
matter of preference in terms of how
view yourself if you're working by
yourself which we want to want to
approach this sort of thing I know that
this can be contentious with development
teams in terms of some teams might not
want to use this contributing module or
have that sort of dependency which
they're sort of with the projects that
they're on so it's a sort of discussion
we need to have some people might feel
more comfortable with Twitter using
these sort of filters instead of the dot
notation to get the values that we're
looking for but I would Lobby in the
sense that you could do both they're not
mutually exclusive if you wanted to have
both your code base might look a bit
messy because you'd have filters and dot
notation calling in field values all
over the place what might not be the
best approach to do so to combine them
but the field target entity filter
that's available to us allows us to do
really cool things so this is why if I
were a LA if I were working with a team
and lobbying for this this contributed
module this to me makes it way more
accessible for someone who's less
experienced would tweak to destruct to
deal with some of the common issues when
we get to more expert use cases like
reference entities
so here we have a piece of content a
note that has an article reference and
if we were to call that we would just
get the whole article in of itself but
let's say we just want a specific value
we just want one field on that entity if
we call in and use the field target
entity filter that gives us access to
all of the fields that are available on
that entity in and of itself so if
you're using nested entities with your
nodes and your paragraphs
this is a really great use case in order
to control the sort of markup and to
have easier access to some of the values
within those entities without having to
do anything with a preprocessor because
another approach that this would be to
you know create a custom module or have
a hug step you know manipulates the
reference entity loads it grabs a
feeling pits it out there could be a lot
more code to do what this does with this
contributed module I'm enough in and of
itself so I think it's a really cool and
valuable useful tool if you are working
with referenced entities
some terms of addressing the issues with
finding values these are the four basic
steps in terms of how you would approach
it in your own development importance
so first always as with almost
everything related to duple you have to
make sure you clear your cache before
you reload your page
just make sure caches are cleared so
that your memories clear the site loads
the latest version next is using the
Twitter debug tool and inspecting the
elements and seeing that you have the
correct template that what you're trying
to do is within the same sort of naming
conventions that Drupal is trying to use
make sure that you have the right field
the Machine name and the property if you
know if you have typos if you if things
are a bit off nothing will clear it
finally we can use the VAR number call
to debug variables in to respect
elements that way so this next portions
of this talk are just going to be
talking mostly about how to address the
do-more some issues that are a big
headache in my own experience as I've
worked with place so first is just
avoiding PHP errors now when we
encounter these sort of errors there's
usually two main reasons why they're
happening for the most part if you're
just working with twig or you're working
within the theme there's two primary
places where things can go wrong the
first place is within the preprocessor
so this might be a common sort of site
and you're working you're making active
changes locally you're making and things
seem to go wrong you get this unexpected
error page please try again later which
means like fix it so
loading the page so pre-processing
issues is the first place to look in
terms of if there are errors on your
site and you're just working a click
check there first
now configuration we can go in there and
see what Arabic in there before I'm
passing in an incorrect render key and
it's causing problems in the ring so
that's why we have that area you can you
can find it you can dig a bit deeper and
see exactly what's happening and I'm
trying to run the needed at least you're
not flying blind the second place to
look if you're encountering there's a
twig is just within twig itself it's
usually pretty forgiving but if you have
any sort of syntax errors then you're
going to encounter some problems if
you're using your filters incorrectly
some filters within twig and the
documentation only accept a certain
number of parameters that you can pass
them like field values or that sort of
thing so if you're counting these are
issues with twig those are the two
places to look and we also can see that
in our database logging we're here we
have a syntax error because there's an
extra curly brace outside of the context
of what twig is trying to render so
we're not using our filter correctly
there so checklists for PHP errors first
just make sure the clear cache is
sometimes I could fix it you think
everything else is okay second is to
make sure you can check your admin /
reports and recent blog messages going
into the database longer to see the sort
of error messaging that you see third
determine whether is the pre-processing
functions or the twig file itself that's
causing you problems and then finally
try to address that problematic line or
the name of the file
efficiently now if you go through all
these steps and you're still having
issues one great way that I'm sure we
all have experience is just till I copy
the air and paste into Google and like
see what other people have done that's
usually will give you enough tools to
start to help find out the issues that
you're encountering and seeing even if
their novel there's something that no
one's experienced or if it's something
that a lot of people have then you can
get there that way in terms of all the
errors that you encountered like white
screen of definitely developing this
usually it's just that big it can be a
big time sink especially if you're only
working with twig or the theme and
you're not doing anything sort of
intensive on the back end and you come
into the bears it can be a huge sort of
headache and hassle and early on with
what's when I first started like I would
have come to these issues and I wouldn't
know exactly how to address them now a
big part of what we encounter these
issues is not necessarily Twitter itself
but because of the tools that we're
using in conjunction with Twitter so
this is probably something that you've
seen before I mean I see it all the time
it's really frustrating where you try to
look your side you get a fatal error it
says your membrane usage is being seated
now there's just a few reasons why this
happens in the first place but the
biggest sort of takeaway is just that
Drupal 8 is object oriented and there's
a lot of arrays and there's a lot of
objects that are being loaded so when
you try to call a debug function on on
certain variables within your files the
sort of memory usage that is trying to
help it's not just outputting the field
like you'd expect but there's a lot of
metadata there's
different things within an object that
causes your memory to overflow and so
that's essentially why this is happening
is in this specific example we're
calling Kent now I I used to look in on
the big fan of Twix bar Delbert just
because Kent seems to consistently
giving his problems no matter what sort
of project I'm on or redundant
environment
I work in work within so the one is just
to maybe not use rely on kids as much
and use some of the other tools
available to us but first let's talk
about the dump function that's available
out of the box without any contributed
modules it's a life screen of death now
this is not mine this is credit to
morning in terms of addressing and the
issue so the carry issue you're calling
a debug function your files your site
isn't working you can't even work with
or see anything being debunked on the
page now within every single tweak file
we have this special keyword variable
called underscore context now underscore
context is just an easier way of when
you call the dumb function without
passing anything in it's gonna be
calling underscore context each and
every time now that we have that you
know passing that underscore context
into a loop allows us to do some cool
things so here all that we're doing here
in this code is going into that context
so all of the things being a little bit
lightweight on that file and getting the
key and getting the values so you're
just going through the array and seeing
each and every item and we're dumping
out the value associated with the key so
that we can see the sort of values that
we have available to us the sort of keys
that are causing us problems
this this is a great tool to put in if
you're encountering the wide screen of
death sort of thing and you're just like
you just want to find a value you just
want to find it
and put it somewhere and you can't seem
to do that video function this will help
you get you on your way to doing that
now let's talk about hints in particular
there's some things that we always have
to remember and it's to make sure that
you pass in a specific variable like if
you don't pass in anything it's going to
kind of load everything and it's usually
I mean there's been issues in the extra
queue to address this but sometimes you
encounter the issue of the memory gets
starts overflow so if you pass in a
specific variable it's going to help you
to load in just what you want into the
debug functions for example of your
trendy bug trying to debug the content
very well in of itself and not the
classes not the metadata the other
things associated with the template you
just make sure you pass that so don't
don't try to just call it can't with
nothing in it that will help you
overcome this sort of issue with the
right screen of death and finally
credits th pool in terms of managing the
levels that can't pass so put in a pre
process function so this would be within
either a module file or a theme file you
can paste in just can't require to make
sure you can't class available to you
and then set the max levels so K by
itself is just gonna try to load in
every single item in metadata associated
with that so like you have a note is
gonna try to so load in your your fields
it's going to try to load in any sort of
entity references and feels associated
that's what you can use there's a lot of
different levels that Kent is trying to
do for you and if you have unlimited
memory you'd be able to see it all but
in our own environments usually we're
limited
the memory that we have so making sure
that our max levels is set gives us
enough leeway to dig a bit deeper into
the content variables and what we have
available to us so that we can still
work with the can still kind of debug
and go through the process without you
know not being able to access our site
at all now a few other tools that we
have available to us for a white screen
of death is limiting search like if you
have a modern computer and you're
working locally you can increase your
memory usage by alot I wouldn't
necessarily recommend unless you get
super frustrated which I found super
frustrated and said like the max like 16
games I kind of like so so if you want
him to feel like memory usage and
sometimes that can help you can do that
in your settings that PHP file there's
other ways to do this is a really sort
of good straightforward way to do so and
finally if we if you've tried all of
these things and you're still having
errors in your settings that PHP you can
turn off all the errors to see all of
them on your page to see like what's
happening is it is it something
different if you're working with the
team that someone else makes something
that you can go to them for and find
assistance for so our checklist for a
white screen of death is the first one
annoys make sure we clear all that
caches finally next is to resolve the
scope of the debug function so passing
something specific into your debugger so
that it's not trying to load the whole
tree of objects third the opening and
closing tags of your twig or pre process
functions or files make sure that
they're there sometimes you're going to
accidentally delete them and you swear
that they're there but they're not
it's a twat another to increase your
memory usage temporarily and finally
just display all the Arabs that are
there so we're going to talk a little
bit about where to go when all of these
things within the checklist don't seem
to help when you've tried using
debuggers and you still just can't seem
to find the values or fix the issues
when you're working with twig-like where
do we go for this sort of advanced help
now first someone to describe like I
would say advanced help in context of
this talk is so first is your sight
stops working completely like you you
try to make a change or you pull down a
change will give or from whatever
version control that you're using and
your slide just doesn't seem to work at
all by any means so it's completely
unresponsive you get a wide screen of s
you try to go to you try to log in and
go to the admin page look at the
database log and it's blank to you check
your database and David's logging
there's nothing near there that site is
like dead like it's just completely dead
that would be one of the definitions of
you know seek out an additional the
second is that the log paid so database
logging seems to be disabled and nothing
comes through and finally your memory
usage is out of control these are all
issues that with the sort of tools that
we have available to us in terms of
managing pins or managing our dumb
functions or using manipulating
configuration files with power our
development environment is structured if
all of those tools don't seem to work
that's the time to find some advanced
software to find see if you can find
some
that can help you I know there's some
resources to find that under itself yeah
these are some great resources that I
personally abuse and encounter in terms
of resolving some very specific use case
issues with Twigg
so let's go and look at a few of them
the first one is Drupal - a contentious
slack it's okay not part of your slack
channel make sure you sign up and join
there's a lot of very intelligent
incredibly intelligent and smart and
help with people there that that if you
have a problem that seems to be novel
something that you can't find in you
google it look for their the IRC channel
is another one that's there
Drupal twig you can find it you know
people talk about great things about it
in with the frustrating if you look at
the hash tag and if I like Stack
Overflow there's another place to find
and seek out that sort of advanced
assistance with twig now if you really
encounter an issue it's like that it
seems to not be anywhere on the web the
best place to check is on the github for
the kwid project in and of itself
there's a lot of different contributors
from Drupal from craft from a lot of
different PHP CMS's that are active and
working on Twitter to make it better and
address these sort of issues so if you
encounter something that seems to be
like oh I don't know anyone's ever seen
this you know make an issue in the issue
queue or search it to see if it's there
except it might be there now finally
with twig there are some really great
ways in terms of leveling off so like
taking our twig skills to the next level
and you know these are just like a few
plugs of tools and things that I found
super useful so the first one if
anyone's going to Drupal con
North America
there's Athena Jubilate training you
know this has been sort of consistent in
terms of all the triple Khan's by the
folks at triple as me last year was sold
out by the time it was man camp I think
right now there's still some slots so if
you're interested in like
learning more about theming Drupal 8 and
writing the twig and and JavaScript and
halt those things I recommend checking
their Drupal ëismí is another really
great resource in terms of learning more
about how Drupal works but also twig in
particular they have some really good
content to dig a bit deeper into some
twig ins in advanced usage came to
university Ryan de Nino there they're
really super folks that have some great
tools not just with tweak but it was
symphony in Drupal 8 a little plug for
chromatic HQ company I work for we have
a blog that we spend a lot of time
curating and and working with this sort
of writing about debriefing about the
issues that we encounter in ourselves
and we're working with twig so be sure
to check it out and subscribe to our
newsletter finally a really good way to
play the best way to level up your
skills and twig or anything is to go to
a sprint so we have a sprint in this
room tomorrow on Sunday anyone that
wants contributor was to check it out I
would encourage everyone to join I know
the first time that I went to a sprint I
was like Brandi to Drupal and I felt
like in Austria like I wouldn't have
been there but I would really recommend
anyone that feels that way to just give
it a try because people here are so kind
in terms of getting people involved in
the community going to issue queue
looking at different things and early on
in my own career I've learned so much by
finding mentors and finding people to
help me in a lot of network
camps and conferences so big shout out
to the spreads that are happening on
Sunday and also throughout the
conference so we have a bit of time for
some questions and answers at the end so
thank you all for being we have the URL
for the slides again yes
I notice it's a it's not a great color
there
so this light Tyler are out there I
notice that there are a couple of
changes I've been making through those
slides the link isn't as to explain the
link will stay the same the decided be
updated I noticed like you wanted to
have was there yes hey what was the
remodel or tweak filters that were
special values label reference entity
and why did I have to come here talk to
my buddy work within the community at
Whitfield value its I mean I only
discovered it in the past like earlier
this year so that good excuse this been
super good go throw them so it's right
here
living yes we used a loop index 0 and a
loop index later opposite difference ok
so this time this so looped out
so with that index 0
index zero is just the counter above the
loop again so that's the throw that
you're on yes
sloop dot index
so here we're we're wanting to find the
specific value equal to two so we're not
going through each and every one in in
the array so the first one we start at
zero goes all yes that's where all they
match that that value sir
yeah this moment yeah we're calling it
just to match that one why are you using
index versus index zero oh so he put it
this is a this is a good question that's
a really good question so I've only used
this in and so for the recording
everything this the question was why
loop index on this slide in particular
and not loop dot index zero equals to
and from focus worth this this is I just
like using a wholesale from more in just
like copy pasted and always work so I
never really gotten into the difference
of why but I know that this works so I
just use this sorry
I think the index zero is just start to
zero in the next time okay so if the
index starts at index zero time to zero
index starts at 1
so we limit our things here and this
life too - what are you - reuse of the
twig week term as well sounds like the
first week before that one yeah so the
question is why I didn't talk about to a
Tweaker like a difference between a
computer module and twig field value I
think that you can create me from long
the tweak tweak does a bit more than the
field value there's a bit more tools
available to you to use that I'm not
gonna be a fan of the field value just
because of the enemy reference sort of
the easiness of that I haven't used
tweet tweet any references in that
context so I'm not sure it's as straight
forward and telling each other chain
values there but to previous is like an
interesting module yes haven't had as
much time using it as the others
that's all the questions here Chris yeah
so in through seven I use our function a
lot one thing that I liked about that
one was that we run through and find the
variable that you're looking for able to
get a relative path pretty easily is
there any way to get relative paths with
either Barca bargain for a dumper or
Kanto images of the ones yeah so for
recording the question is the relative
back using KP r is pretty accessible and
is it as accessible with don't remember
first just to clarify the direct path of
what I introduced with a particular
variable so I in kpr it spits out all
these things but when you found what
you're looking for you know will click
it and give you whether it's objects or
rays but the how to get to this
particular value with Canton these other
ones these newer ones
seems like you have to draw your own map
all the way to the valley that you're
looking for so if it's nested six levels
deep you'd have to keep track of which
array objects and this it's known that
so I would say dump is not good at
helping you
in the self kenta's a little better of
our dumper with the tool that we have
here it's a bit of both world so you can
try to click through and and create that
sort of pathway but it doesn't always
work I think that an easier way of doing
that is like combining the debug
functions with some of the standard the
Drupal calls sort so in this case we're
talking one more specific with that like
a preprocessor and then there like a
quick debugger in and of itself so like
combining an approach of first always
try to see if you can you know retrace
it using the same sort of methodology
we've had with kpr but if that doesn't
work usually there's some things we can
do to at least the object that we find
in there to find a specific value or to
find something using it
or something like that yes
sort of a hard time finding the exact
value
yeah usually the first approach it just
to make sure you'd calm your field names
like feel like if you have and that
Islamic state sometimes you'll have
access to the configuration to see the
Machine name of fields but if you do
have that access to call that and just
call it value to see like its outputs
were to pass that into the book function
if not you can go deeper or the try to
open up the stack of in ones calling the
content variable to see what's available
to you oh sorry for the recording the
question was like how you it's not
always clear like how to get specific
value for people you know that stuff
like with this presentation in
particular with the URL that's like the
line that's probably that odd man out in
terms of field values and then lists
select lists fields those ones usually
are their difference in terms of time of
course of the most at time to be your
like your entity or a content your
people name value to fine
yes of course beginning you had
[Music]
placed
I'm assuming that bottle trade where I
was there was dissipation between
yes that's a really good question so the
question is in this talk we have PI R
squared u RL as a twig function and that
is a dribble specific functions is that
there's a handful of doable specific
functions an easy way to do is you just
looked at the twig documentation online
I think that there's it's less than it's
like a handful of twig functions are
very specific to Drupal compile URLs is
just one of them this is just a twig
documentation bridgeable will have those
filters and functions available to
yes something had interest like the
encounter of problem where I had to
tweak debugger and I was trying to get a
get the rather value for this boolean
but when I output the value to an actual
like tweak debugging text will be in
there as well so I had to like convert
it to a string and then I strip it
for balls that get angry too late but
move that from the dump when you're
getting can I get just true or false
value
yes so question is when we've looked
like boolean fields sometimes when we
try to debug them or try to you know
assign a variable to true or false
nature there are always usually
populated right like when you try to
check for it these things usually within
there yeah yeah that's a that's been a
huge frustration personally with like my
own brute-force approach is to
pre-process it do custom approach in
terms of like creating a custom variable
and then using that to determine whether
there's true or false true there's
values like the consistency of using
some of these things like there's
metadata or other things associated with
those content things that are like you
speak you speak specific and like
somewhat frustrating to dig a bit deeper
into but I would just try to pre-process
it instead of trying to handle it within
twig and I'm using the law or using all
these different filters to go through it
but yeah