protected function EntityFormProxy::getTypesByValue in Lightning Media 8.3
Same name and namespace in other branches
- 8.4 src/Plugin/EntityBrowser/Widget/EntityFormProxy.php \Drupal\lightning_media\Plugin\EntityBrowser\Widget\EntityFormProxy::getTypesByValue()
Returns media types which can accept a given value in their source field.
Parameters
mixed $value: The input value.
Return value
\Drupal\media\MediaTypeInterface[] The media types which can use the given value in their source field.
2 calls to EntityFormProxy::getTypesByValue()
- EntityFormProxy::getCurrentTypes in src/
Plugin/ EntityBrowser/ Widget/ EntityFormProxy.php - Returns all media types that can apply to the current input.
- EntityFormProxy::validate in src/
Plugin/ EntityBrowser/ Widget/ EntityFormProxy.php
File
- src/
Plugin/ EntityBrowser/ Widget/ EntityFormProxy.php, line 292
Class
- EntityFormProxy
- Base class for EB widgets which wrap around an (inline) entity form.
Namespace
Drupal\lightning_media\Plugin\EntityBrowser\WidgetCode
protected function getTypesByValue($value) {
$filter = function (MediaTypeInterface $media_type) use ($value) {
$source = $media_type
->getSource();
return $source instanceof InputMatchInterface && $source
->appliesTo($value, $media_type);
};
return array_filter($this
->getAllowedTypes(), $filter);
}