You are here

private function ProjectListForm::optimizelyProjectRow in Optimizely 8

Build render array for one row of the table of projects.

1 call to ProjectListForm::optimizelyProjectRow()
ProjectListForm::buildForm in src/ProjectListForm.php
Form constructor.

File

src/ProjectListForm.php, line 169

Class

ProjectListForm
Implements the form for the Projects Listing.

Namespace

Drupal\optimizely

Code

private function optimizelyProjectRow($proj) {
  $enabled = array_key_exists('checked', $proj['enable']['#attributes']) ? TRUE : FALSE;
  $render = [
    'class' => [
      'project-row-' . $proj['#project_code'],
    ],
    'id' => [
      'project-' . $proj['#oid'],
    ],
    'data' => [
      [
        'class' => $enabled ? 'enable-column enabled' : 'enable-column disabled',
        'data' => $proj['enable'],
      ],
      [
        'class' => $enabled ? 'project-title-column enabled' : 'project-title-column disabled',
        'data' => $proj['#project_title'],
      ],
      [
        'class' => $enabled ? 'admin-links-column enabled' : 'admin-links-column disabled',
        'data' => $proj['#admin_links'],
      ],
      [
        'class' => $enabled ? 'paths-column enabled' : 'paths-column disabled',
        'data' => $proj['#paths'],
      ],
      [
        'class' => $enabled ? 'project-code-column enabled' : 'project-code-column disabled',
        'data' => $proj['#project_code'],
      ],
    ],
  ];
  return $render;
}