$content([$lang])->has($key)

Checks if a field exists

  • $field (string)
    A field name
  • $lang (string)
    Optional, language code in multi-lang installation
  • return (array)

Example

<?php
if($page->content()->has('somefield')) {
  echo $page->somefield()->kirbytext();
}
?>

Is something missing or incorrect? Edit this page on Github…