Domanda

Ho fatto un campo utilizzando personalizzato Formattatori (Drupal, CCK).
Ora ho questo codice PHP per l'esportazione

/**
* Implements hook_theme().
*/
function product_attribute_theme() {
  return array(
    'product_attribute_formatter_product_attribute' => array(
      'arguments' => array('element' => NULL),
    ),
  );
}

/**
* Implements hook_field_formatter_info().
*/
function product_attribute_field_formatter_info() {
  return array(
    'product_attribute' => array(
      'label' => 'Product Attribute',
      'description' => t('an Attribute of a Product'),
      'field types' => array('content_taxonomy', 'text'),
      'multiple values' => CONTENT_HANDLE_MODULE,
    ),
  );
}

function theme_product_attribute_formatter_product_attribute($element) {
  return ($element['#item']['value']);
}

Ho provato ad aggiungerlo come un modulo in CCK ma non ha aggiungo ai campi, come faccio a fare così?

È stato utile?

Soluzione

Il formattatore è stato creato ed esportato deve ancora essere scelto come il formattatore attiva per il vostro specifico settore, che si può fare senza esportare il formattatore.

Per fare questo, in realtà dipende da dove e ciò che si voleva formattato, ma in generale, che è probabile che sia un campo CCK su un display nodo, che può essere impostato nella pagina Content Types 'campi Schermo': http: // [www .yoursite.com / path / to / drupal] / admin / content / node-type / [content-type] / visualizzazione

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top