You are here

public function FasttoggleController::groupAndSettingFromFieldName in Fasttoggle 8.2

Get the group and setting for a field name.

Parameters

\Drupal\Core\Field\FieldDefinitionInterface: The field with the value to be toggled.

Return value

array The group and setting - NULL if not found.

File

src/Controller/FasttoggleController.php, line 105

Class

FasttoggleController
Route controller for Fasttoggle.

Namespace

Drupal\fasttoggle\Controller

Code

public function groupAndSettingFromFieldName($definition) {
  $settingPlugin = $this->settingManager
    ->match($definition);
  if ($settingPlugin) {
    $group = $settingPlugin
      ->getPluginDefinition()['group'];
    $groupPlugin = $this->settingGroupManager
      ->createInstance($group);
  }
  else {
    $groupPlugin = NULL;
  }
  return array(
    $groupPlugin,
    $settingPlugin,
  );
}