You are here

function ffc_condition_execute_hide_link_when_title_is_empty in Field formatter conditions 7

Hide the link URL in case the title is empty.

File

./ffc.module, line 212
Field formatter conditions.

Code

function ffc_condition_execute_hide_link_when_title_is_empty(&$build, $source, $configuration) {
  if (!empty($build[$source]['#items'])) {
    foreach ($build[$source]['#items'] as $key => $info) {

      // If the title is left empty on the entity form, the link module
      // will fill in the url in that field.
      if ($info['title'] === $info['url']) {
        unset($build[$source]['#items'][$key]);
      }
    }
  }
  if (empty($build[$source]['#items'])) {
    $build[$source]['#access'] = FALSE;
  }
}