You are here

function entityform_update_7006 in Entityform 7.2

Delete old Entityform menu links.

File

./entityform.install, line 225
Sets up the base table for our entity and a table to store information about the entity types.

Code

function entityform_update_7006(&$sandbox) {
  $message = NULL;
  $entityform_types = db_query("SELECT type FROM {entityform_type}")
    ->fetchCol();
  $result = db_query("SELECT mlid, link_path FROM {menu_links} WHERE router_path = 'eform/submit/%'", array(), array(
    'fetch' => PDO::FETCH_ASSOC,
  ));
  foreach ($result as $m) {
    $link_parts = explode('/', $m['link_path']);
    $entityform_type = str_replace('-', '_', $link_parts[2]);
    if (!in_array($entityform_type, $entityform_types)) {
      $message = t('Deleted old entityform type menu links.');
      menu_link_delete($m['mlid']);
    }
  }
  return $message;
}