Startseite
  • » Home
  • » Handbuch & FAQ
  • » Forum
  • » Übersetzungsserver
  • » Suche
Startseite › Forum › Drupalcenter.de › Module ›

Recipe Modul Frage

Eingetragen von hasel (136)
am 20.07.2012 - 17:57 Uhr in
  • Module
  • Drupal 7.x

Hallo,

ich habe eine Frage und zwar gibt es bei dem Recipe Modul 2 Felder "recipe_preptime" und "recipe_cooktime" ich möchte diese beiden Felder addieren so das ich die Gesamtzeit herausbekomme. Ich weiß nur nicht genau wo ich ansetzen soll. ich habe in der Modul datei eine stelle gefunden wo das schon addiert wird. Ich brauche das nur extra als view Ausgabe.

/**
* Default theme implementation for the recipe summary box.
*/
function theme_recipe_summary($variables) {

  $node = $variables['node'];
  $show_title = isset($variables['show_title']) ? $variables['show_title'] : FALSE;
  $show_yield_form = isset($variables['show_yield_form']) ? $variables['show_yield_form'] : TRUE;
  // Construct the summary
  $output = '<div class="recipe-summary">';

  if ( $show_title ) {
    $output .= '<h2 class="title">' . t('Summary') . '</h2>';
  }

  $output .= '<table>';

  // Render the yield form.
  $yield_form = drupal_get_form('recipe_yield_form', $node, $show_yield_form);
  $output .= '<tr><th class="summary-title">' . t('Yield') . '</th><td class="summary-data">' . drupal_render($yield_form) . '</td></tr>';

  if ($node->recipe_source) {
    $output .= '<tr><th>' . t('Source') . '</th><td>' . $node->recipe_source . '</td></tr>';
  }
  if (isset($node->recipe_preptime)) {
    $_o_minutes = $node->recipe_preptime;
    $_hours = floor($_o_minutes / 60);
    $_minutes = $_o_minutes - ($_hours * 60);
    $_text = '';
    if ($_hours > 0) {
      $_text = format_plural($_hours, '1 hour', '@count hours');
    }
    if ($_minutes > 0) {
      if (strlen($_text) > 0) {
        $_text .= ', ';
      }
      $_text .= format_plural($_minutes, '1 minute', '@count minutes');
    }
   

    // Wrap description in RDFa markup.
    if ( !empty($node->rdf_mapping['recipe_preptime']) ) {
      $attributes = rdf_rdfa_attributes($node->rdf_mapping['recipe_preptime']);
      $attributes['content'] = array(recipe_duration_iso8601($_o_minutes));
      $_text = theme('rdf_template_variable_wrapper', array('content' => $_text, 'attributes' => $attributes, 'inline' => FALSE));
    }

    $output .= '<tr><th>' . t('Prep time') . '</th><td>' . $_text . '</td></tr>';
  }

  if (isset($node->recipe_cooktime)) {
    $_o_minutes = $node->recipe_cooktime;
    $_hours = floor($_o_minutes / 60);
    $_minutes = $_o_minutes - ($_hours * 60);
    $_text = '';
    if ($_hours > 0) {
      $_text = format_plural($_hours, '1 hour', '@count hours');
    }
    if ($_minutes > 0) {
      if (strlen($_text) > 0) {
        $_text .= ', ';
      }
      $_text .= format_plural($_minutes, '1 minute', '@count minutes');
    }

    // Wrap description in RDFa markup.
    if ( !empty($node->rdf_mapping['recipe_cooktime']) ) {
      $attributes = rdf_rdfa_attributes($node->rdf_mapping['recipe_cooktime']);
      $attributes['content'] = array(recipe_duration_iso8601($_o_minutes));
      $_text = theme('rdf_template_variable_wrapper', array('content' => $_text, 'attributes' => $attributes, 'inline' => FALSE));
    }

    $output .= '<tr><th>' . t('Cooking time') . '</th><td>' . $_text . '</td></tr>';
  }

  if (isset($node->recipe_cooktime) && isset($node->recipe_preptime)) {
    $_o_minutes = $node->recipe_cooktime + $node->recipe_preptime;
    $_hours = floor($_o_minutes / 60);
    $_minutes = $_o_minutes - ($_hours * 60);
    $_text = '';
    if ($_hours > 0) {
      $_text = format_plural($_hours, '1 hour', '@count hours');
    }
    if ($_minutes > 0) {
      if (strlen($_text) > 0) {
        $_text .= ', ';
      }
      $_text .= format_plural($_minutes, '1 minute', '@count minutes');
    }

    // Wrap description in RDFa markup.
    if ( !empty($node->rdf_mapping['recipe_totaltime']) ) {
      $attributes = rdf_rdfa_attributes($node->rdf_mapping['recipe_totaltime']);
      $attributes['content'] = array(recipe_duration_iso8601($_o_minutes));
      $_text = theme('rdf_template_variable_wrapper', array('content' => $_text, 'attributes' => $attributes, 'inline' => FALSE));
    }

    $output .= '<tr><th>' . t('Total time') . '</th><td>' . $_text . '</td></tr>';
  }

  $output .= '</table>';
  $output .= '</div><div class="shadow-right"></div>';

  return $output;
}

ich weiß nur nicht wie ich das jetzt in ein extra feld eingeben muss.

Kann mir da jemand weiterhelfen, mir vielleicht einen Ansatz zeigen.

Liebe Grüße
André

‹ Meta Descriptions lassen sich für einzelne Seiten nicht ändern. Suche in nur einem Buch ermöglichen ›
  • Anmelden oder Registrieren um Kommentare zu schreiben

sorry ich bin es

Eingetragen von hasel (136)
am 23.07.2012 - 19:03 Uhr

sorry ich bin es nochmal,

hoffe ich habe meine Frage richtig formuliert. Hat da jemand von euch einen Ansatzpunkt für mich da happerts irgendwie bei mir.

lg
André

  • Anmelden oder Registrieren um Kommentare zu schreiben

ich bins noch mal, ich habe

Eingetragen von hasel (136)
am 25.07.2012 - 14:33 Uhr

ich bins noch mal,

ich habe jetzt das Modul "views global php" installiert da kann ich den passenden Code eingeben.

Nur haperts noch am Code. Kann mir keiner einen kleinen Tipp geben wo ich ansetzen muss bin echt schon am verzweifeln :-(

lg
hasel

  • Anmelden oder Registrieren um Kommentare zu schreiben

Benutzeranmeldung

  • Registrieren
  • Neues Passwort anfordern

Aktive Forenthemen

  • Lokale Entwicklungsumgebung auf Windows
  • Drupalcenter tot?
  • Drupal-Forks und ihre Schwächen/Stärken
  • Was kann ich gegen ständige Blutergüsse tun?
  • Mir gefällt die Drupal Symfony und deren Composer
  • Mir ist da was aufgefallen ;)
  • Matomo Installation
  • Verständnisfrage private_files in Drupal
  • [gelöst] Drupal 7 Forum Beitrag mit Bilder einstellen
  • erfahrung mit dem Modul script manager
  • [erledigt]MP3 in Drupal 10 einbinden
  • HTML oder JS Code wird nicht ausgeführt
Weiter

Neue Kommentare

  • Zusatzfragen
    vor 13 Stunden 33 Minuten
  • DDEV verwaltet Container, sowohl Docker als auch andere
    vor 13 Stunden 46 Minuten
  • Entwicklungsumgebung ist nicht nur Server
    vor 13 Stunden 58 Minuten
  • Danke
    vor 1 Tag 20 Stunden
  • [gelöst] Danke!
    vor 1 Tag 20 Stunden
  • Ja natürlich tun wir dass.
    vor 2 Tagen 15 Stunden
  • Drupal.de verweist aufs Drupal Center
    vor 2 Tagen 16 Stunden
  • Und falls du auf grüne
    vor 2 Tagen 17 Stunden
  • Danke euch beiden, das bringt
    vor 2 Tagen 17 Stunden
  • Bei mir war es ähnlich – ich
    vor 2 Tagen 17 Stunden

Statistik

Beiträge im Forum: 250041
Registrierte User: 20354

Neue User:

  • tom082
  • Bubabujalka
  • GerdMelzner

» Alle User anzeigen

User nach Punkten sortiert:
wla9456
stBorchert6003
quiptime4972
Tobias Bähr4019
bv3924
ronald3855
md3717
Thoor3678
Alexander Langer3416
Exterior2903
» User nach Punkten
Zur Zeit sind 0 User und 5 Gäste online.

Hauptmenü

  • » Home
  • » Handbuch & FAQ
  • » Forum
  • » Übersetzungsserver
  • » Suche

Quicklinks I

  • Infos
  • Drupal Showcase
  • Installation
  • Update
  • Forum
  • Team
  • Verhaltensregeln

Quicklinks II

  • Drupal Jobs
  • FAQ
  • Drupal-Kochbuch
  • Best Practice - Drupal Sites - Guidelines
  • Drupal How To's

Quicklinks III

  • Tipps & Tricks
  • Drupal Theme System
  • Theme Handbuch
  • Leitfaden zur Entwicklung von Modulen

RSS & Twitter

  • Drupal Planet deutsch
  • RSS Feed News
  • RSS Feed Planet
  • Twitter Drupalcenter
Drupalcenter Team | Impressum & Datenschutz | Kontakt
Angetrieben von Drupal | Drupal is a registered trademark of Dries Buytaert.
Drupal Initiative - Drupal Association