By claudiu.cristea on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
9.5.x
Introduced in version:
9.5.0
Issue links:
Description:
It's possible now to disable tableselect rows by setting the #disabled property on the rows to be disabled.
$header = [
'first_name' => $this->t('First Name'),
'last_name' => $this->t('Last Name'),
];
$options = [
1 => ['first_name' => 'Indy', 'last_name' => 'Jones'],
2 => ['first_name' => 'Darth', 'last_name' => 'Vader'],
// Prevent users from selecting this row by adding a '#disabled' property set
// to TRUE.
3 => ['first_name' => 'Super', 'last_name' => 'Man', '#disabled' => TRUE],
];
$form['table'] = array(
'#type' => 'tableselect',
'#header' => $header,
'#options' => $options,
'#empty' => $this->t('No users found'),
);
Impacts:
Module developers
Themers
Site templates, recipes and distribution developers