I've created my own Permission module in Drupal 8 i have a problem with the body field.

It's disabled and grayed with this message : This field has been disabled because you do not have sufficient permissions to edit it.

How can i activate ckeditor and this field for all users since it's already protected in my Permssion module ?

Comments

usethe23 created an issue. See original summary.

mgifford’s picture

I don't think this is an accessibility issue.

Was the form just marked readonly?

Wim Leers’s picture

Component: ckeditor.module » filter.module
Status: Active » Fixed
Issue tags: -ckeditor, -permissions, -Accessibility

This is not remotely related to the CKEditor module.

If you'd have searched for that string, you'd have found this:

function filter_form_access_denied($element) {
  $element['#value'] = t('This field has been disabled because you do not have sufficient permissions to edit it.');
  return $element;
}

If you then search for that function name, you'd have found it's being called by this code:

    // Disable this widget, if the user is not allowed to use the stored format,
    // or if the stored format does not exist. The 'administer filters'
    // permission only grants access to the filter administration, not to all
    // formats.
    elseif (!$user_has_access || !$format_exists) {
      // Overload default values into #value to make them unalterable.
      $element['value']['#value'] = $element['value']['#default_value'];
      $element['format']['format']['#value'] = $element['format']['format']['#default_value'];

      // Prepend #pre_render callback to replace field value with user notice
      // prior to rendering.
      $element['value'] += array('#pre_render' => array());
      array_unshift($element['value']['#pre_render'], 'filter_form_access_denied');

In other words: the whole problem is that your user doesn't have sufficient permissions. And it sounds like that's related to your custom code.

With this information, you should be able to figure out what's wrong in your code :)

mxr576’s picture

Status: Fixed » Active

If you search for this message then you can see this is not related to custom permissions. This is a built in feature/bug of the Drupal since 7, caused by the current user does not have access to a filter format (ex.: full html) which has been used by an another user, who saved a certain node/entity's long text field's value before.

Wim Leers’s picture

Status: Active » Fixed

That's what #3 already explained. The reason I mentioned And it sounds like that's related to your custom code. is because the OP says I've created my own Permission module in Drupal 8 which sounds questionable.

In any case, #4 just explains what I said more clearly, but that means this issue is still "fixed" :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

muhammad.tanweer’s picture

Yeah this is a permission issue. The user/role in question should have permission to use the Text Format (input format) which is used ont hat text area field.