You are here

function _entity_embed_button_is_enabled in Entity Embed 7.3

Same name and namespace in other branches
  1. 7 entity_embed.module \_entity_embed_button_is_enabled()
  2. 7.2 entity_embed.module \_entity_embed_button_is_enabled()

Checks whether or not the embed button is enabled for given text format.

Returns allowed if the editor toolbar contains the embed button and neutral otherwise.

Parameters

$filter_format: The filter format to which this dialog corresponds.

$embed_button: The embed button to which this dialog corresponds.

Return value

boolean The access result.

1 string reference to '_entity_embed_button_is_enabled'
entity_embed_menu in ./entity_embed.module
Implements hook_menu().

File

./entity_embed.module, line 306
Provides a CKEditor plugin and text filter for embedding and rendering entities.

Code

function _entity_embed_button_is_enabled($filter_format, $embed_button) {
  editor_format_ensure_additional_properties($filter_format);
  if (!editor_load($filter_format->editor)) {
    return FALSE;
  }
  $button_name = $embed_button->name;
  if (!empty($filter_format->editor_settings['toolbar'])) {
    foreach ($filter_format->editor_settings['toolbar'] as $row) {
      foreach ($row as $button_group) {
        if (in_array($button_name, $button_group['items'])) {
          return TRUE;
        }
      }
    }
  }
  return FALSE;
}