You are here

function webform_share_entity_operation in Webform 6.x

Same name and namespace in other branches
  1. 8.5 modules/webform_share/webform_share.module \webform_share_entity_operation()

Implements hook_entity_operation().

File

modules/webform_share/webform_share.module, line 124
Allows webforms to be shared on other websites using an iframe.

Code

function webform_share_entity_operation(EntityInterface $entity) {
  $operations = [];
  if ($entity instanceof WebformInterface && $entity
    ->access('update') && $entity
    ->getSetting('share', TRUE)) {
    $operations['share'] = [
      'title' => t('Share'),
      'url' => $entity
        ->toUrl('share-embed'),
      'weight' => 80,
    ];
  }
  return $operations;
}