You are here

public function DashboardAssignBlockForm::blockIdExists in Draggable dashboard 8.2

Parameters

$machine_name:

$form:

\Drupal\Core\Form\FormStateInterface $form_state:

Return value

bool

File

src/Form/DashboardAssignBlockForm.php, line 83

Class

DashboardAssignBlockForm
Class DashboardAssignBlockForm

Namespace

Drupal\draggable_dashboard\Form

Code

public function blockIdExists($machine_name, $form, FormStateInterface $form_state) {

  // Get existing blocks from current dashboard.
  $dashboard_blocks = $this->dashboard
    ->get('blocks');

  // If empty return early.
  if (empty($dashboard_blocks)) {
    return FALSE;
  }
  $blocks = array_keys($dashboard_blocks);
  return in_array($machine_name, $blocks, TRUE);
}