public static function ConfigPages::config in Config Pages 8
Same name and namespace in other branches
- 8.3 src/Entity/ConfigPages.php \Drupal\config_pages\Entity\ConfigPages::config()
- 8.2 src/Entity/ConfigPages.php \Drupal\config_pages\Entity\ConfigPages::config()
3 calls to ConfigPages::config()
- ConfigPagesBlock::build in src/
Plugin/ Block/ ConfigPagesBlock.php - Builds and returns the renderable array for this block plugin.
- ConfigPagesBlock::getCacheTags in src/
Plugin/ Block/ ConfigPagesBlock.php - The cache tags associated with this object.
- config_pages_config in ./
config_pages.module - Helper function. Returns config page entity.
File
- src/
Entity/ ConfigPages.php, line 172
Class
- ConfigPages
- Defines the config page entity class.
Namespace
Drupal\config_pages\EntityCode
public static function config($type, $context = NULL) {
// Build conditions.
if (!empty($type)) {
$conditions['type'] = $type;
// Get current context if NULL.
if ($context == NULL) {
$type = ConfigPagesType::load($type);
if (!is_object($type)) {
return NULL;
}
$conditions['context'] = $type
->getContextData();
}
else {
$conditions['context'] = $context;
}
$list = \Drupal::entityTypeManager()
->getStorage('config_pages')
->loadByProperties($conditions);
}
return $list ? current($list) : NULL;
}