テキストの条件付き文字列を出力するための Twig の短い構文はありますか?
<h1>{% if not info.id %}create{% else %}edit{% endif %}</h1>
従来の php はこれよりもさらに簡単です。
<h1><?php info['id']? 'create' : 'edit' ?></h1>
これはうまくいくはずです:
{{ not info.id ? 'create' : 'edit' }}
また、これは三項演算子と呼ばれます。ドキュメントに隠されているようなものです:twig docs:operator
彼らのドキュメントから、基本的な構造は次のとおりです。
{{ foo ? 'yes' : 'no' }}