Skip to content

Commit

Permalink
Add status css for unpublished.
Browse files Browse the repository at this point in the history
  • Loading branch information
rosiel committed Nov 9, 2023
1 parent f4368c2 commit 8d4a9d5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 0 deletions.
Empty file added web/modules/custom/.gitkeep
Empty file.
3 changes: 3 additions & 0 deletions web/modules/custom/islandlives/css/islandlives.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tr.Unpublished {
background-color: #FFF4F4;
}
6 changes: 6 additions & 0 deletions web/modules/custom/islandlives/islandlives.libraries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
unpublished:
version: 1.x
css:
theme:
css/islandlives.css: {}

16 changes: 16 additions & 0 deletions web/modules/custom/islandlives/islandlives.module
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

use Drupal\pathauto\PathautoPatternInterface;
use Drupal\views\ViewExecutable;

/**
* Implements hook_pathauto_pattern_alter().
Expand All @@ -23,3 +24,18 @@ function islandlives_pathauto_pattern_alter(PathautoPatternInterface $pattern, a
}
}
}

/**
* Implements hook_views_pre_render().
*/
function islandlives_views_pre_render(ViewExecutable $view) {
$applicable_views = [
'content',
'media',
'manage_members',
'media_of',
];
if (isset($view) && (in_array($view->storage->id(), $applicable_views))) {
$view->element['#attached']['library'][] = 'islandlives/unpublished';
}
}

0 comments on commit 8d4a9d5

Please sign in to comment.