Same name and namespace in other branches
- 5.0.x src/ViewsSlideshowWidgetTypeBase.php \Drupal\views_slideshow\ViewsSlideshowWidgetTypeBase::checkCompatiblity()
Overrides ViewsSlideshowWidgetTypeInterface::checkCompatiblity
Fichier
-
src/
ViewsSlideshowWidgetTypeBase.php, line 102
Classe
- ViewsSlideshowWidgetTypeBase
- Base class for a Views slideshow widget type.
Namespace
Drupal\views_slideshowCode
public function checkCompatiblity($slideshow) {
$is_compatible = 1;
// Check if every required accept value in the widget has a
// corresponding calls value in the slideshow.
foreach ($this->pluginDefinition['accepts'] as $accept_key => $accept_value) {
if (is_array($accept_value) && !empty($accept_value['required']) && !in_array($accept_key, $slideshow['calls'])) {
$is_compatible = 0;
break;
}
}
// No need to go through this if it's not compatible.
if ($is_compatible) {
// Check if every required calls value in the widget has a
// corresponding accepts call.
foreach ($this->pluginDefinition['calls'] as $calls_key => $calls_value) {
if (is_array($calls_value) && !empty($calls_value['required']) && !in_array($calls_key, $slideshow['accepts'])) {
$is_compatible = 0;
break;
}
}
}
return $is_compatible;
}