You are here

protected function LayoutBuilderRestrictionsByRegionHelperTrait::regionRestrictionStatusString in Layout Builder Restrictions 8.2

Wrapper function for regionRestrictionStatus() that returns a string.

Either $static_id or $entity_view_display_id is required.

Parameters

string $layout_plugin: The machine name of the layout plugin.

string $region_id: The machine name of the region.

mixed $static_id: (optional) A unique string representing a built form; optionally NULL.

mixed $entity_view_display_id: (optional) The ID of the entity view display; optionally NULL.

Return value

string Either 'Restricted' or 'Unrestricted'.

File

modules/layout_builder_restrictions_by_region/src/Traits/LayoutBuilderRestrictionsByRegionHelperTrait.php, line 90

Class

LayoutBuilderRestrictionsByRegionHelperTrait
Methods to help Layout Builder Restrictions By Region plugin.

Namespace

Drupal\layout_builder_restrictions_by_region\Traits

Code

protected function regionRestrictionStatusString(string $layout_plugin, string $region_id, $static_id = NULL, $entity_view_display_id = NULL) {
  $restriction = $this
    ->regionRestrictionStatus($layout_plugin, $region_id, $static_id, $entity_view_display_id);
  if ($restriction == TRUE) {
    return 'Restricted';
  }
  elseif ($restriction == FALSE) {
    return 'Unrestricted';
  }
}