X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Ffront%2Ffront_page.module;fp=web%2Fmodules%2Fcontrib%2Ffront%2Ffront_page.module;h=5c3f646d7faa736149cfdb14f73c6705939a2369;hp=39c6a361ff7a77c6136865bbc5de8e9cf715adcd;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/modules/contrib/front/front_page.module b/web/modules/contrib/front/front_page.module index 39c6a361f..5c3f646d7 100644 --- a/web/modules/contrib/front/front_page.module +++ b/web/modules/contrib/front/front_page.module @@ -7,38 +7,36 @@ * This version is for Drupal 8. * Earlier versions can be found at http://drupal.org/project/front. * - * This module version was developed by timhilliard and various members - * of the drupal community. - * * If you have any ideas/patches or requests, * please post them at http://drupal.org/project/issues/front. */ use Drupal\Core\Database\Database; use Drupal\Core\Render\Element; -use \Drupal\Core\Link; -use \Drupal\Core\Url; +use Drupal\Core\Routing\RouteMatchInterface; /** * Implements hook_help(). */ -function front_page_help($route_name, \Drupal\Core\Routing\RouteMatchInterface $route_match) { +function front_page_help($route_name, RouteMatchInterface $route_match) { switch ($route_name) { case 'front_page.settings': return t('

Setup custom front pages for your site.

'); - case 'front_page.home_links': + case 'help.page.front_page': return t('

If a HOME link is set, the <front> placeholder will be replaced with this value instead of the standard front page.

'); } } /** + * Parse URL including GET and fragment. + * * Function to parse a full URL including GET variables and fragment * to an array ready for drupal_goto(), url(), or l() functions. */ function front_page_parse_url($path) { $url['path'] = $path; - $url['options'] = array(); + $url['options'] = []; if (preg_match('@^(?P[^?#]+)(\?(?P[^#]*))?(#(?P.*))?$@', $path, $match)) { $url['path'] = $match['path']; if (!empty($match['query'])) { @@ -102,12 +100,12 @@ function front_page_get_all() { * Implements hook_theme(). */ function front_page_theme() { - return array( - 'front_page_admin_arrange_form' => array( + return [ + 'front_page_admin_arrange_form' => [ 'render element' => 'form', 'function' => 'theme_front_page_admin_arrange_form', - ), - ); + ], + ]; } /** @@ -126,57 +124,63 @@ function front_page_user_role_delete($role) { * @param array $variables * An associative array containing: * - form: A render element representing the form. + * + * @return string + * Rendered admin form. + * + * @todo Refactor this function, it's a legacy way. */ function theme_front_page_admin_arrange_form($variables) { $form = $variables['form']; // Enable the drag handles. - drupal_attach_tabledrag($form['roles'], array( + drupal_attach_tabledrag($form['roles'], [ 'table_id' => 'front-page-arrange', 'action' => 'order', 'relationship' => 'sibling', 'group' => 'front-page-weight', - )); + ]); - $header = array( + $header = [ t('Role'), t('Mode'), t('Preview'), t('Enabled'), t('Weight'), - ); + ]; - $rows = array(); + $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'] = array('front-page-weight'); + $element['weight']['#attributes']['class'] = ['front-page-weight']; - $row = array(); + $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(array('data' => $row), $element['#attributes']); + $row = array_merge(['data' => $row], $element['#attributes']); $row['class'][] = 'draggable'; $rows[] = $row; } $output = ''; if (empty($rows)) { - $rows[] = array(array('data' => 'no roles', 'colspan' => '5')); + $rows[] = [['data' => 'no roles', 'colspan' => '5']]; } $front_page_arrange = [ '#theme' => 'table', '#header' => $header, '#rows' => $rows, - 'attributes' => array('id' => 'front-page-arrange'), + 'attributes' => ['id' => 'front-page-arrange'], ]; $output .= $renderer->render($front_page_arrange); $output .= drupal_render_children($form); + return $output; }