Get the node title conditionally in a view rewrite field

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












How can I get the field for the title of the content?



In twig I need to do this (for jssor slider) :



% if field_titre_url_externe is not empty %
field_titre_url_externe
% else %
field_title
% endif %


but field_title is showing nothing, so what is the name of this?



EDIT :



I'm talking about the title of a node , article or content type



In my frontend, the title has the class views-field-title



See this image for more details (that's what I want to do):



enter image description here



Access the field_url_externe is not working actually... Accessing this field will solve my problem










share|improve this question









New contributor




Morgan Morgan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • The term "title field" is a generic, ambiguous term. It would help if you clarified and narrowed the scope of your question. Is this the "title" for a Node? The title of a view? Which template are you modifying and what are you doing? At the moment it's unclear to me what exactly you're trying to do. Thank you.
    – mradcliffe
    3 hours ago

















up vote
1
down vote

favorite












How can I get the field for the title of the content?



In twig I need to do this (for jssor slider) :



% if field_titre_url_externe is not empty %
field_titre_url_externe
% else %
field_title
% endif %


but field_title is showing nothing, so what is the name of this?



EDIT :



I'm talking about the title of a node , article or content type



In my frontend, the title has the class views-field-title



See this image for more details (that's what I want to do):



enter image description here



Access the field_url_externe is not working actually... Accessing this field will solve my problem










share|improve this question









New contributor




Morgan Morgan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.



















  • The term "title field" is a generic, ambiguous term. It would help if you clarified and narrowed the scope of your question. Is this the "title" for a Node? The title of a view? Which template are you modifying and what are you doing? At the moment it's unclear to me what exactly you're trying to do. Thank you.
    – mradcliffe
    3 hours ago













up vote
1
down vote

favorite









up vote
1
down vote

favorite











How can I get the field for the title of the content?



In twig I need to do this (for jssor slider) :



% if field_titre_url_externe is not empty %
field_titre_url_externe
% else %
field_title
% endif %


but field_title is showing nothing, so what is the name of this?



EDIT :



I'm talking about the title of a node , article or content type



In my frontend, the title has the class views-field-title



See this image for more details (that's what I want to do):



enter image description here



Access the field_url_externe is not working actually... Accessing this field will solve my problem










share|improve this question









New contributor




Morgan Morgan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











How can I get the field for the title of the content?



In twig I need to do this (for jssor slider) :



% if field_titre_url_externe is not empty %
field_titre_url_externe
% else %
field_title
% endif %


but field_title is showing nothing, so what is the name of this?



EDIT :



I'm talking about the title of a node , article or content type



In my frontend, the title has the class views-field-title



See this image for more details (that's what I want to do):



enter image description here



Access the field_url_externe is not working actually... Accessing this field will solve my problem







views 8 nodes






share|improve this question









New contributor




Morgan Morgan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Morgan Morgan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 hours ago









Cesar Moore

677314




677314






New contributor




Morgan Morgan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 4 hours ago









Morgan Morgan

84




84




New contributor




Morgan Morgan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Morgan Morgan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Morgan Morgan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











  • The term "title field" is a generic, ambiguous term. It would help if you clarified and narrowed the scope of your question. Is this the "title" for a Node? The title of a view? Which template are you modifying and what are you doing? At the moment it's unclear to me what exactly you're trying to do. Thank you.
    – mradcliffe
    3 hours ago

















  • The term "title field" is a generic, ambiguous term. It would help if you clarified and narrowed the scope of your question. Is this the "title" for a Node? The title of a view? Which template are you modifying and what are you doing? At the moment it's unclear to me what exactly you're trying to do. Thank you.
    – mradcliffe
    3 hours ago
















The term "title field" is a generic, ambiguous term. It would help if you clarified and narrowed the scope of your question. Is this the "title" for a Node? The title of a view? Which template are you modifying and what are you doing? At the moment it's unclear to me what exactly you're trying to do. Thank you.
– mradcliffe
3 hours ago





The term "title field" is a generic, ambiguous term. It would help if you clarified and narrowed the scope of your question. Is this the "title" for a Node? The title of a view? Which template are you modifying and what are you doing? At the moment it's unclear to me what exactly you're trying to do. Thank you.
– mradcliffe
3 hours ago











2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










This is the correct value for the rewrite field:



% if field_url_externe is not empty %
field_url_externe
% else %
title
% endif %


You can see the available fields in the "Replace Patterns" expandable link.



enter image description here






share|improve this answer






















  • This is for the plugin jssor slider, I don't think it has something to do with the theme... The twig part I'm trying to add is in the view part in backend
    – Morgan Morgan
    3 hours ago











  • Twig is part of the theming system in Drupal...
    – Cesar Moore
    3 hours ago










  • Are you using the jssor Drupal module?, are you using a Drupal view? I am trying to understand better your implementation.
    – Cesar Moore
    3 hours ago










  • Yes for jssor drupal module. The part with title_prefix is not working. I'm using a view in drupal backend. This my update post for more details
    – Morgan Morgan
    3 hours ago







  • 1




    It's working, I wasn't on the right page. Thanks a lot !
    – Morgan Morgan
    2 hours ago

















up vote
2
down vote













Is title a field you made or do you mean the node title? Node title can be printed with either label or node.getTitle() .



Fields that you created on the node, they are rendered out as:



content.field_title



Which can be checked as:



% if node.field_title_external is not empty %
content.field_title_external
% else %
node.getTitle()
% endif %


You can also use label instead of node.getTitle() .






share|improve this answer






















  • It's indeed showing the external link, but the title of the node is not showing
    – Morgan Morgan
    4 hours ago










  • That seems impossible unless this is not shown in the context of a node? Title of what node exactly? Title of the node being viewed, or title of a referenced node? A different field title?
    – Kevin
    3 hours ago










  • Title of the node articles (drupal) and some custom content type. The title of a drupal article and it's external link will be the same, but the link won't. If the external link is set, don't show drupal article title but show external link
    – Morgan Morgan
    3 hours ago










  • Ok, you are doing this from Views, which is different than the normal theming methods.
    – Kevin
    2 hours ago










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "220"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






Morgan Morgan is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdrupal.stackexchange.com%2fquestions%2f269731%2fget-the-node-title-conditionally-in-a-view-rewrite-field%23new-answer', 'question_page');

);

Post as a guest






























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










This is the correct value for the rewrite field:



% if field_url_externe is not empty %
field_url_externe
% else %
title
% endif %


You can see the available fields in the "Replace Patterns" expandable link.



enter image description here






share|improve this answer






















  • This is for the plugin jssor slider, I don't think it has something to do with the theme... The twig part I'm trying to add is in the view part in backend
    – Morgan Morgan
    3 hours ago











  • Twig is part of the theming system in Drupal...
    – Cesar Moore
    3 hours ago










  • Are you using the jssor Drupal module?, are you using a Drupal view? I am trying to understand better your implementation.
    – Cesar Moore
    3 hours ago










  • Yes for jssor drupal module. The part with title_prefix is not working. I'm using a view in drupal backend. This my update post for more details
    – Morgan Morgan
    3 hours ago







  • 1




    It's working, I wasn't on the right page. Thanks a lot !
    – Morgan Morgan
    2 hours ago














up vote
1
down vote



accepted










This is the correct value for the rewrite field:



% if field_url_externe is not empty %
field_url_externe
% else %
title
% endif %


You can see the available fields in the "Replace Patterns" expandable link.



enter image description here






share|improve this answer






















  • This is for the plugin jssor slider, I don't think it has something to do with the theme... The twig part I'm trying to add is in the view part in backend
    – Morgan Morgan
    3 hours ago











  • Twig is part of the theming system in Drupal...
    – Cesar Moore
    3 hours ago










  • Are you using the jssor Drupal module?, are you using a Drupal view? I am trying to understand better your implementation.
    – Cesar Moore
    3 hours ago










  • Yes for jssor drupal module. The part with title_prefix is not working. I'm using a view in drupal backend. This my update post for more details
    – Morgan Morgan
    3 hours ago







  • 1




    It's working, I wasn't on the right page. Thanks a lot !
    – Morgan Morgan
    2 hours ago












up vote
1
down vote



accepted







up vote
1
down vote



accepted






This is the correct value for the rewrite field:



% if field_url_externe is not empty %
field_url_externe
% else %
title
% endif %


You can see the available fields in the "Replace Patterns" expandable link.



enter image description here






share|improve this answer














This is the correct value for the rewrite field:



% if field_url_externe is not empty %
field_url_externe
% else %
title
% endif %


You can see the available fields in the "Replace Patterns" expandable link.



enter image description here







share|improve this answer














share|improve this answer



share|improve this answer








edited 2 hours ago

























answered 4 hours ago









Cesar Moore

677314




677314











  • This is for the plugin jssor slider, I don't think it has something to do with the theme... The twig part I'm trying to add is in the view part in backend
    – Morgan Morgan
    3 hours ago











  • Twig is part of the theming system in Drupal...
    – Cesar Moore
    3 hours ago










  • Are you using the jssor Drupal module?, are you using a Drupal view? I am trying to understand better your implementation.
    – Cesar Moore
    3 hours ago










  • Yes for jssor drupal module. The part with title_prefix is not working. I'm using a view in drupal backend. This my update post for more details
    – Morgan Morgan
    3 hours ago







  • 1




    It's working, I wasn't on the right page. Thanks a lot !
    – Morgan Morgan
    2 hours ago
















  • This is for the plugin jssor slider, I don't think it has something to do with the theme... The twig part I'm trying to add is in the view part in backend
    – Morgan Morgan
    3 hours ago











  • Twig is part of the theming system in Drupal...
    – Cesar Moore
    3 hours ago










  • Are you using the jssor Drupal module?, are you using a Drupal view? I am trying to understand better your implementation.
    – Cesar Moore
    3 hours ago










  • Yes for jssor drupal module. The part with title_prefix is not working. I'm using a view in drupal backend. This my update post for more details
    – Morgan Morgan
    3 hours ago







  • 1




    It's working, I wasn't on the right page. Thanks a lot !
    – Morgan Morgan
    2 hours ago















This is for the plugin jssor slider, I don't think it has something to do with the theme... The twig part I'm trying to add is in the view part in backend
– Morgan Morgan
3 hours ago





This is for the plugin jssor slider, I don't think it has something to do with the theme... The twig part I'm trying to add is in the view part in backend
– Morgan Morgan
3 hours ago













Twig is part of the theming system in Drupal...
– Cesar Moore
3 hours ago




Twig is part of the theming system in Drupal...
– Cesar Moore
3 hours ago












Are you using the jssor Drupal module?, are you using a Drupal view? I am trying to understand better your implementation.
– Cesar Moore
3 hours ago




Are you using the jssor Drupal module?, are you using a Drupal view? I am trying to understand better your implementation.
– Cesar Moore
3 hours ago












Yes for jssor drupal module. The part with title_prefix is not working. I'm using a view in drupal backend. This my update post for more details
– Morgan Morgan
3 hours ago





Yes for jssor drupal module. The part with title_prefix is not working. I'm using a view in drupal backend. This my update post for more details
– Morgan Morgan
3 hours ago





1




1




It's working, I wasn't on the right page. Thanks a lot !
– Morgan Morgan
2 hours ago




It's working, I wasn't on the right page. Thanks a lot !
– Morgan Morgan
2 hours ago












up vote
2
down vote













Is title a field you made or do you mean the node title? Node title can be printed with either label or node.getTitle() .



Fields that you created on the node, they are rendered out as:



content.field_title



Which can be checked as:



% if node.field_title_external is not empty %
content.field_title_external
% else %
node.getTitle()
% endif %


You can also use label instead of node.getTitle() .






share|improve this answer






















  • It's indeed showing the external link, but the title of the node is not showing
    – Morgan Morgan
    4 hours ago










  • That seems impossible unless this is not shown in the context of a node? Title of what node exactly? Title of the node being viewed, or title of a referenced node? A different field title?
    – Kevin
    3 hours ago










  • Title of the node articles (drupal) and some custom content type. The title of a drupal article and it's external link will be the same, but the link won't. If the external link is set, don't show drupal article title but show external link
    – Morgan Morgan
    3 hours ago










  • Ok, you are doing this from Views, which is different than the normal theming methods.
    – Kevin
    2 hours ago














up vote
2
down vote













Is title a field you made or do you mean the node title? Node title can be printed with either label or node.getTitle() .



Fields that you created on the node, they are rendered out as:



content.field_title



Which can be checked as:



% if node.field_title_external is not empty %
content.field_title_external
% else %
node.getTitle()
% endif %


You can also use label instead of node.getTitle() .






share|improve this answer






















  • It's indeed showing the external link, but the title of the node is not showing
    – Morgan Morgan
    4 hours ago










  • That seems impossible unless this is not shown in the context of a node? Title of what node exactly? Title of the node being viewed, or title of a referenced node? A different field title?
    – Kevin
    3 hours ago










  • Title of the node articles (drupal) and some custom content type. The title of a drupal article and it's external link will be the same, but the link won't. If the external link is set, don't show drupal article title but show external link
    – Morgan Morgan
    3 hours ago










  • Ok, you are doing this from Views, which is different than the normal theming methods.
    – Kevin
    2 hours ago












up vote
2
down vote










up vote
2
down vote









Is title a field you made or do you mean the node title? Node title can be printed with either label or node.getTitle() .



Fields that you created on the node, they are rendered out as:



content.field_title



Which can be checked as:



% if node.field_title_external is not empty %
content.field_title_external
% else %
node.getTitle()
% endif %


You can also use label instead of node.getTitle() .






share|improve this answer














Is title a field you made or do you mean the node title? Node title can be printed with either label or node.getTitle() .



Fields that you created on the node, they are rendered out as:



content.field_title



Which can be checked as:



% if node.field_title_external is not empty %
content.field_title_external
% else %
node.getTitle()
% endif %


You can also use label instead of node.getTitle() .







share|improve this answer














share|improve this answer



share|improve this answer








edited 3 hours ago

























answered 4 hours ago









Kevin

16.1k84399




16.1k84399











  • It's indeed showing the external link, but the title of the node is not showing
    – Morgan Morgan
    4 hours ago










  • That seems impossible unless this is not shown in the context of a node? Title of what node exactly? Title of the node being viewed, or title of a referenced node? A different field title?
    – Kevin
    3 hours ago










  • Title of the node articles (drupal) and some custom content type. The title of a drupal article and it's external link will be the same, but the link won't. If the external link is set, don't show drupal article title but show external link
    – Morgan Morgan
    3 hours ago










  • Ok, you are doing this from Views, which is different than the normal theming methods.
    – Kevin
    2 hours ago
















  • It's indeed showing the external link, but the title of the node is not showing
    – Morgan Morgan
    4 hours ago










  • That seems impossible unless this is not shown in the context of a node? Title of what node exactly? Title of the node being viewed, or title of a referenced node? A different field title?
    – Kevin
    3 hours ago










  • Title of the node articles (drupal) and some custom content type. The title of a drupal article and it's external link will be the same, but the link won't. If the external link is set, don't show drupal article title but show external link
    – Morgan Morgan
    3 hours ago










  • Ok, you are doing this from Views, which is different than the normal theming methods.
    – Kevin
    2 hours ago















It's indeed showing the external link, but the title of the node is not showing
– Morgan Morgan
4 hours ago




It's indeed showing the external link, but the title of the node is not showing
– Morgan Morgan
4 hours ago












That seems impossible unless this is not shown in the context of a node? Title of what node exactly? Title of the node being viewed, or title of a referenced node? A different field title?
– Kevin
3 hours ago




That seems impossible unless this is not shown in the context of a node? Title of what node exactly? Title of the node being viewed, or title of a referenced node? A different field title?
– Kevin
3 hours ago












Title of the node articles (drupal) and some custom content type. The title of a drupal article and it's external link will be the same, but the link won't. If the external link is set, don't show drupal article title but show external link
– Morgan Morgan
3 hours ago




Title of the node articles (drupal) and some custom content type. The title of a drupal article and it's external link will be the same, but the link won't. If the external link is set, don't show drupal article title but show external link
– Morgan Morgan
3 hours ago












Ok, you are doing this from Views, which is different than the normal theming methods.
– Kevin
2 hours ago




Ok, you are doing this from Views, which is different than the normal theming methods.
– Kevin
2 hours ago










Morgan Morgan is a new contributor. Be nice, and check out our Code of Conduct.









 

draft saved


draft discarded


















Morgan Morgan is a new contributor. Be nice, and check out our Code of Conduct.












Morgan Morgan is a new contributor. Be nice, and check out our Code of Conduct.











Morgan Morgan is a new contributor. Be nice, and check out our Code of Conduct.













 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdrupal.stackexchange.com%2fquestions%2f269731%2fget-the-node-title-conditionally-in-a-view-rewrite-field%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

Long meetings (6-7 hours a day): Being “babysat” by supervisor

Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

Confectionery