function MenuLink::hasTranslation

Same name in other branches
  1. 10 core/modules/menu_link_content/src/Plugin/migrate/source/MenuLink.php \Drupal\menu_link_content\Plugin\migrate\source\MenuLink::hasTranslation()
  2. 11.x core/modules/menu_link_content/src/Plugin/migrate/source/MenuLink.php \Drupal\menu_link_content\Plugin\migrate\source\MenuLink::hasTranslation()

Determines if this menu_link has an i18n translation.

Parameters

string $mlid: The menu id.

Return value

bool True if the menu_link has an i18n translation.

1 call to MenuLink::hasTranslation()
MenuLink::prepareRow in core/modules/menu_link_content/src/Plugin/migrate/source/MenuLink.php
Adds additional data to the row.

File

core/modules/menu_link_content/src/Plugin/migrate/source/MenuLink.php, line 181

Class

MenuLink
Drupal 6/7 menu link source from database.

Namespace

Drupal\menu_link_content\Plugin\migrate\source

Code

public function hasTranslation($mlid) {
    if ($this->getDatabase()
        ->schema()
        ->tableExists('i18n_string')) {
        $results = $this->select('i18n_string', 'i18n')
            ->fields('i18n')
            ->condition('textgroup', 'menu')
            ->condition('type', 'item')
            ->condition('objectid', $mlid)
            ->execute()
            ->fetchAll();
        if ($results) {
            return TRUE;
        }
    }
    return FALSE;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.