You are here

public function LinkitProfile::setEnabledAttributePlugins in Linkit 7.3

Set all enabled attribure plugins.

1 call to LinkitProfile::setEnabledAttributePlugins()
LinkitProfile::getEnabledAttributePlugins in includes/profile.class.php
Construct an array with all the enabled attribute plugins for this profile.

File

includes/profile.class.php, line 36
Linkit Profile class.

Class

LinkitProfile
Linkit Profile class implementation.

Code

public function setEnabledAttributePlugins() {
  foreach ($this->data['attribute_plugins'] as $attribute_name => $attribute) {
    if ($attribute['enabled']) {

      // Load the attribute plugin.
      $attribute_plugin = linkit_attribute_plugin_load($attribute_name);

      // Call the callback to get the FAPI element.
      if (isset($attribute_plugin['callback']) && function_exists($attribute_plugin['callback'])) {
        $attribute_html = $attribute_plugin['callback']($attribute_plugin, $attribute);

        // Add Linkit specific class, this is used by the editor JS scripts.
        $attribute_html['#attributes']['class'][] = 'linkit-attribute';
        $this->enabled_attribute_plugins[$attribute_name] = $attribute_html;
      }
    }
  }
}