本文整理匯總了PHP中Drupal\image\Entity\ImageStyle::getEffects方法的典型用法代碼示例。如果您正苦於以下問題:PHP ImageStyle::getEffects方法的具體用法?PHP ImageStyle::getEffects怎麽用?PHP ImageStyle::getEffects使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Drupal\image\Entity\ImageStyle
的用法示例。
在下文中一共展示了ImageStyle::getEffects方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getCropType
/**
* Get the crop type correspond to current image style.
*
* @param \Drupal\image\Entity\ImageStyle $image_style
* The properties of the crop applied to the original image (dimensions).
*
* @return string $crop_type
* The name of Crop type.
*/
public function getCropType(ImageStyle $image_style)
{
// Confirm that all effects on the image style have settings that match
// what was saved.
$uuids = array();
/** @var \Drupal\image\ImageEffectInterface $effect */
foreach ($image_style->getEffects() as $uuid => $effect) {
// Store the uuid for later use.
$uuids[$effect->getPluginId()] = $uuid;
}
if (isset($uuids['image_widget_crop_crop'])) {
$crop_type = $image_style->getEffect($uuids['image_widget_crop_crop'])->getConfiguration()['data']['crop_type'];
} else {
$crop_type = FALSE;
}
return $crop_type;
}