Created
May 3, 2018 12:25
-
-
Save suresh-kumara-gist/71bc151aae7a137c8f13230c635915b8 to your computer and use it in GitHub Desktop.
alias uniquifier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Drupal\Core\Language\LanguageInterface; | |
echo strcmp("/", "/"); | |
$test = \Drupal::service("pathauto.alias_cleaner")->cleanString("1"); | |
$langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; | |
$source = ""; | |
$alias = $test; | |
$test = \Drupal::service("pathauto.alias_uniquifier")->uniquify($alias, $source, $langcode) ; | |
use Drupal\Core\Language\LanguageInterface; | |
echo strcmp("/", "/"); | |
$test = \Drupal::service("pathauto.alias_cleaner")->cleanString("1"); | |
$langcode = LanguageInterface::LANGCODE_NOT_SPECIFIED; | |
$source = "/node/131749"; | |
$alias = "/ca-agile-central/saas/1"; | |
$test = \Drupal::service("pathauto.alias_uniquifier")->uniquify($alias, $source, $langcode) ; | |
function getaliasCount($alias) { | |
$query = \Drupal::database()->select('url_alias', 'ua'); | |
$query->addExpression('COUNT(*)'); | |
$or_group = $query->orConditionGroup() | |
->condition('alias', rtrim($alias, '/'), 'LIKE') | |
->condition('alias', rtrim($alias, '/') . '-%', 'LIKE'); | |
$count = $query->condition($or_group)->execute()->fetchField(); | |
return $count; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment