- π©πͺGermany Anybody Porta Westfalica
Please check what's left to be done here now that π Missing config schema & fix weight spelling RTBC is merged.
- Issue was unassigned.
- Status changed to Closed: outdated
9 months ago 8:05am 5 April 2024
Need to refactor deprecated and very legacy code.
/**
* Implements hook_theme().
*/
function front_page_theme() {
return [
'front_page_admin_arrange_form' => [
'render element' => 'form',
'function' => 'theme_front_page_admin_arrange_form',
],
];
}
function theme_front_page_admin_arrange_form($variables) {
$form = $variables['form'];
// Enable the drag handles.
drupal_attach_tabledrag($form['roles'], [
'table_id' => 'front-page-arrange',
'action' => 'order',
'relationship' => 'sibling',
'group' => 'front-page-weight',
]);
$header = [
t('Role'),
t('Mode'),
t('Preview'),
t('Enabled'),
t('Weight'),
];
$rows = [];
$renderer = \Drupal::service('renderer');
foreach (Element::children($form['roles']) as $rid) {
$element = &$form['roles'][$rid];
// Add special classes to be used for tabledrag.js.
$element['weight']['#attributes']['class'] = ['front-page-weight'];
$row = [];
$row[] = $renderer->render($element['title'], FALSE);
$row[] = $renderer->render($element['mode'], FALSE);
$row[] = $renderer->render($element['preview'], FALSE);
$row[] = $renderer->render($element['enabled'], FALSE);
$row[] = $renderer->render($element['weight'], FALSE);
$row = array_merge(['data' => $row], $element['#attributes']);
$row['class'][] = 'draggable';
$rows[] = $row;
}
$output = '';
if (empty($rows)) {
$rows[] = [['data' => 'no roles', 'colspan' => '5']];
}
$front_page_arrange = [
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
'attributes' => ['id' => 'front-page-arrange'],
];
$output .= $renderer->render($front_page_arrange);
foreach (Element::children($form) as $key) {
if (!empty($form[$key])) {
$output .= \Drupal::service('renderer')->render($form[$key]);
}
}
return $output;
}
Just a little bit more context.
There was a form with ID front_page_admin_arrange_form
, but it was removed in this commit. That's why the theme_front_page_admin_arrange_form
function is not needed any more.
Closed: outdated
10.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Please check what's left to be done here now that π Missing config schema & fix weight spelling RTBC is merged.