public function ConfigPagesValueAccess::getConfigPageFields in Config Pages 8.2
Same name and namespace in other branches
- 8.3 src/Plugin/Condition/ConfigPagesValueAccess.php \Drupal\config_pages\Plugin\Condition\ConfigPagesValueAccess::getConfigPageFields()
Returns list of fields for config page.
Return value
array Array of operators with their descriptions.
1 call to ConfigPagesValueAccess::getConfigPageFields()
- ConfigPagesValueAccess::buildConfigurationForm in src/
Plugin/ Condition/ ConfigPagesValueAccess.php - Form constructor.
File
- src/
Plugin/ Condition/ ConfigPagesValueAccess.php, line 166
Class
- ConfigPagesValueAccess
- Provides a 'Access by ConfigPage field value' condition.
Namespace
Drupal\config_pages\Plugin\ConditionCode
public function getConfigPageFields($type) {
$result = [];
if (!empty($type)) {
// Get custom fields from config page.
$base_fields = $this->entityFieldManager
->getBaseFieldDefinitions('config_pages');
$fields = $this->entityFieldManager
->getFieldDefinitions('config_pages', $type);
$custom_fields = array_diff_key($fields, $base_fields);
// Build select options.
foreach ($custom_fields as $id => $field_config) {
$field_type = $field_config
->getType();
if (in_array($field_type, $this->allowedFieldTypes)) {
$result[$type . '|' . $id . '|' . $field_type] = $field_config
->getLabel() . ' (' . $id . ')';
}
}
}
return $result;
}