Loading src/Widget/WidgetData.php +11 −0 Changes for src/Widget/WidgetData.php: 11 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -25,6 +25,17 @@ class WidgetData { * @return array */ public function output($entity, WidgetInstanceEntity $widget_instance_entity, WidgetEntity $widget_entity, $widget_region = 'content', $field_properties = []) { $result = Drupal::moduleHandler()->invokeAll('stacks_pre_output', array( $entity, $widget_instance_entity, $widget_entity, )); if (!empty($result['skip'])) { return []; } $entity_id = $entity->id(); $field_exceptions = []; Loading stacks.api.php +20 −0 Changes for stacks.api.php: 20 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -24,3 +24,23 @@ function hook_stacks_output_alter(&$render_array, $entity, $widget_entity) {} * 'options', which are the options that are sent to the query builder function. */ function hook_widget_node_results_alter(&$query, $group, &$context) {} /** * Allows modules to prevent a specfic widget for being displayed * * @param Entity $entity: The entity that holds the widget * @param WidgetInstanceEntity $widget_instance_entity: The container entity that referecne the widget * @param WidgetEntity $widget_instance: The actual widget entity * @return array: * 'skip': If true, the widget not be displayed */ function hook_stacks_pre_output($entity, WidgetInstanceEntity $widget_instance_entity, WidgetEntity $widget_entity) { $entity = $args['entity']; // Perform some validations. $result['skip'] = TRUE; return $result; } Loading
src/Widget/WidgetData.php +11 −0 Changes for src/Widget/WidgetData.php: 11 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -25,6 +25,17 @@ class WidgetData { * @return array */ public function output($entity, WidgetInstanceEntity $widget_instance_entity, WidgetEntity $widget_entity, $widget_region = 'content', $field_properties = []) { $result = Drupal::moduleHandler()->invokeAll('stacks_pre_output', array( $entity, $widget_instance_entity, $widget_entity, )); if (!empty($result['skip'])) { return []; } $entity_id = $entity->id(); $field_exceptions = []; Loading
stacks.api.php +20 −0 Changes for stacks.api.php: 20 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -24,3 +24,23 @@ function hook_stacks_output_alter(&$render_array, $entity, $widget_entity) {} * 'options', which are the options that are sent to the query builder function. */ function hook_widget_node_results_alter(&$query, $group, &$context) {} /** * Allows modules to prevent a specfic widget for being displayed * * @param Entity $entity: The entity that holds the widget * @param WidgetInstanceEntity $widget_instance_entity: The container entity that referecne the widget * @param WidgetEntity $widget_instance: The actual widget entity * @return array: * 'skip': If true, the widget not be displayed */ function hook_stacks_pre_output($entity, WidgetInstanceEntity $widget_instance_entity, WidgetEntity $widget_entity) { $entity = $args['entity']; // Perform some validations. $result['skip'] = TRUE; return $result; }