diff --git a/core/modules/content_moderation/content_moderation.info.yml b/core/modules/content_moderation/content_moderation.info.yml index b25c7ce0f1dd55cf707670e2570a7171dbdb43e7..335e92ba0266b19bc8391fe1aeef4985fcc48dd7 100644 --- a/core/modules/content_moderation/content_moderation.info.yml +++ b/core/modules/content_moderation/content_moderation.info.yml @@ -1,9 +1,9 @@ name: 'Content Moderation' type: module -description: 'Provides moderation states for content' +description: 'Provides moderation states for content.' version: VERSION core: 8.x -package: Core (Experimental) +package: Core configure: entity.workflow.collection dependencies: - workflows diff --git a/core/modules/content_moderation/content_moderation.module b/core/modules/content_moderation/content_moderation.module index 2ae1e0da3a0a4870986e98401cf37947cf328277..985f91f08b8a37cae246e0cea80bf69c576b0747 100644 --- a/core/modules/content_moderation/content_moderation.module +++ b/core/modules/content_moderation/content_moderation.module @@ -20,10 +20,12 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\Core\Url; use Drupal\workflows\WorkflowInterface; use Drupal\Core\Action\Plugin\Action\PublishAction; use Drupal\Core\Action\Plugin\Action\UnpublishAction; use Drupal\workflows\Entity\Workflow; +use Drupal\views\Entity\View; /** * Implements hook_help(). @@ -34,13 +36,20 @@ function content_moderation_help($route_name, RouteMatchInterface $route_match) case 'help.page.content_moderation': $output = ''; $output .= '<h3>' . t('About') . '</h3>'; - $output .= '<p>' . t('The Content Moderation module provides moderation for content by applying workflows to content. For more information, see the <a href=":content_moderation">online documentation for the Content Moderation module</a>.', [':content_moderation' => 'https://www.drupal.org/documentation/modules/content_moderation']) . '</p>'; + $output .= '<p>' . t('The Content Moderation module allows you to expand on Drupal\'s "unpublished" and "published" states for content. It allows you to have a published version that is live, but have a separate working copy that is undergoing review before it is published. This is achieved by using <a href=":workflows">Workflows</a> to apply different states and transitions to entities as needed. For more information, see the <a href=":content_moderation">online documentation for the Content Moderation module</a>.', [':content_moderation' => 'https://www.drupal.org/documentation/modules/content_moderation', ':workflows' => Url::fromRoute('help.page', ['name' => 'workflows'])->toString()]) . '</p>'; $output .= '<h3>' . t('Uses') . '</h3>'; $output .= '<dl>'; - $output .= '<dt>' . t('Configuring workflows') . '</dt>'; - $output .= '<dd>' . t('Enable the Workflow UI module to create, edit and delete content moderation workflows.') . '</p>'; + $output .= '<dt>' . t('Applying workflows') . '</dt>'; + $output .= '<dd>' . t('Content Moderation allows you to apply <a href=":workflows">Workflows</a> to content, custom blocks, and other <a href=":field_help" title="Field module help, with background on content entities">content entities</a>, to provide more fine-grained publishing options. For example, a Basic page might have states such as Draft and Published, with allowed transitions such as Draft to Published (making the current revision "live"), and Published to Draft (making a new draft revision of published content).', [':workflows' => Url::fromRoute('help.page', ['name' => 'workflows'])->toString(), ':field_help' => Url::fromRoute('help.page', ['name' => 'field'])->toString()]) . '</dd>'; + if (\Drupal::moduleHandler()->moduleExists('views')) { + $moderated_content_view = View::load('moderated_content'); + if (isset($moderated_content_view) && $moderated_content_view->status() === TRUE) { + $output .= '<dt>' . t('Moderating content') . '</dt>'; + $output .= '<dd>' . t('You can view a list of content awaiting moderation on the <a href=":moderated">moderated content page</a>. This will show any content in an unpublished state, such as Draft or Archived, to help surface content that requires more work from content editors.', [':moderated' => Url::fromRoute('view.moderated_content.moderated_content')->toString()]) . '</dd>'; + } + } $output .= '<dt>' . t('Configure Content Moderation permissions') . '</dt>'; - $output .= '<dd>' . t('Each transition is exposed as a permission. If a user has the permission for a transition, then they can move that node from the start state to the end state') . '</p>'; + $output .= '<dd>' . t('Each transition is exposed as a permission. If a user has the permission for a transition, they can use the transition to change the state of the content item, from Draft to Published.') . '</dd>'; $output .= '</dl>'; return $output; } diff --git a/core/modules/content_moderation/css/content_moderation.module.css b/core/modules/content_moderation/css/content_moderation.module.css index 4c6a0c1dd687c30a3e780cd5f290a497dcfba380..1df1823e3063f18a884b1771e8951809e83edc34 100644 --- a/core/modules/content_moderation/css/content_moderation.module.css +++ b/core/modules/content_moderation/css/content_moderation.module.css @@ -2,7 +2,7 @@ * @file * Component styles for the content_moderation module. */ -ul.entity-moderation-form { +.entity-moderation-form { list-style: none; display: -webkit-flex; /* Safari */ display: flex; @@ -12,31 +12,27 @@ ul.entity-moderation-form { align-items: flex-start; } -ul.entity-moderation-form li { +.entity-moderation-form__item { margin-right: 2em; display: table; } -ul.entity-moderation-form li:last-child { +.entity-moderation-form__item:last-child { -webkit-align-self: flex-end; /* Safari */ align-self: flex-end; margin-right: 0; } -ul.entity-moderation-form .form-item { +.entity-moderation-form .form-item { margin-top: 1em; margin-bottom: 1em; } -ul.entity-moderation-form .form-item label { +.entity-moderation-form .form-item label { padding-bottom: 0.25em; display: table; } -ul.entity-moderation-form input[type=submit] { +.entity-moderation-form input[type=submit] { margin-bottom: 1.2em; } - -ul.entity-moderation-form .btn { - margin-bottom: 1.1em; -} diff --git a/core/modules/content_moderation/css/content_moderation.theme.css b/core/modules/content_moderation/css/content_moderation.theme.css index 36ebf04cd884953a3e25f7aceaa5b4a6135c602d..827e911f3883a6856e2e68a057a6d56517792ee3 100644 --- a/core/modules/content_moderation/css/content_moderation.theme.css +++ b/core/modules/content_moderation/css/content_moderation.theme.css @@ -2,7 +2,7 @@ * @file * Theme styles for the content_moderation module. */ -ul.entity-moderation-form { +.entity-moderation-form { border: 1px dashed #bbb; margin: 2em 0; background: #fff; diff --git a/core/modules/content_moderation/templates/entity-moderation-form.html.twig b/core/modules/content_moderation/templates/entity-moderation-form.html.twig index b3665a7b79aea76fbfda2e7b3b160251cded153a..7638e374c2158087417ad71bc4177842352546d8 100644 --- a/core/modules/content_moderation/templates/entity-moderation-form.html.twig +++ b/core/modules/content_moderation/templates/entity-moderation-form.html.twig @@ -1,8 +1,8 @@ {{ attach_library('content_moderation/content_moderation') }} <ul class="entity-moderation-form"> - <li>{{ form.current }}</li> - <li>{{ form.new_state }}</li> - <li>{{ form.revision_log }}</li> - <li>{{ form.submit }}</li> + <li class="entity-moderation-form__item">{{ form.current }}</li> + <li class="entity-moderation-form__item">{{ form.new_state }}</li> + <li class="entity-moderation-form__item">{{ form.revision_log }}</li> + <li class="entity-moderation-form__item">{{ form.submit }}</li> </ul> {{ form|without('current', 'new_state', 'revision_log', 'submit') }} diff --git a/core/themes/stable/css/content_moderation/content_moderation.module.css b/core/themes/stable/css/content_moderation/content_moderation.module.css new file mode 100644 index 0000000000000000000000000000000000000000..1df1823e3063f18a884b1771e8951809e83edc34 --- /dev/null +++ b/core/themes/stable/css/content_moderation/content_moderation.module.css @@ -0,0 +1,38 @@ +/** + * @file + * Component styles for the content_moderation module. + */ +.entity-moderation-form { + list-style: none; + display: -webkit-flex; /* Safari */ + display: flex; + -webkit-flex-wrap: wrap; /* Safari */ + flex-wrap: wrap; + -webkit-align-items: flex-start; /* Safari */ + align-items: flex-start; +} + +.entity-moderation-form__item { + margin-right: 2em; + display: table; +} + +.entity-moderation-form__item:last-child { + -webkit-align-self: flex-end; /* Safari */ + align-self: flex-end; + margin-right: 0; +} + +.entity-moderation-form .form-item { + margin-top: 1em; + margin-bottom: 1em; +} + +.entity-moderation-form .form-item label { + padding-bottom: 0.25em; + display: table; +} + +.entity-moderation-form input[type=submit] { + margin-bottom: 1.2em; +} diff --git a/core/themes/stable/css/content_moderation/content_moderation.theme.css b/core/themes/stable/css/content_moderation/content_moderation.theme.css new file mode 100644 index 0000000000000000000000000000000000000000..827e911f3883a6856e2e68a057a6d56517792ee3 --- /dev/null +++ b/core/themes/stable/css/content_moderation/content_moderation.theme.css @@ -0,0 +1,10 @@ +/** + * @file + * Theme styles for the content_moderation module. + */ +.entity-moderation-form { + border: 1px dashed #bbb; + margin: 2em 0; + background: #fff; + padding-left: 1em; +} diff --git a/core/themes/stable/stable.info.yml b/core/themes/stable/stable.info.yml index 957a65cf3563fc372d255105b916f8d7b1c2988e..3f019d065b8bdd4e250a9f9995b93caebb10a074 100644 --- a/core/themes/stable/stable.info.yml +++ b/core/themes/stable/stable.info.yml @@ -45,6 +45,13 @@ libraries-override: theme: css/content_translation.admin.css: css/content_translation/content_translation.admin.css + content_moderation/content_moderation: + css: + component: + css/content_moderation.module.css: css/content_moderation/content_moderation.module.css + theme: + css/content_moderation.theme.css: css/content_moderation/content_moderation.theme.css + contextual/drupal.contextual-links: css: component: diff --git a/core/themes/stable/templates/content-edit/entity-moderation-form.html.twig b/core/themes/stable/templates/content-edit/entity-moderation-form.html.twig new file mode 100644 index 0000000000000000000000000000000000000000..7638e374c2158087417ad71bc4177842352546d8 --- /dev/null +++ b/core/themes/stable/templates/content-edit/entity-moderation-form.html.twig @@ -0,0 +1,8 @@ +{{ attach_library('content_moderation/content_moderation') }} +<ul class="entity-moderation-form"> + <li class="entity-moderation-form__item">{{ form.current }}</li> + <li class="entity-moderation-form__item">{{ form.new_state }}</li> + <li class="entity-moderation-form__item">{{ form.revision_log }}</li> + <li class="entity-moderation-form__item">{{ form.submit }}</li> +</ul> +{{ form|without('current', 'new_state', 'revision_log', 'submit') }}