How can I get the current node view mode and add to block template suggestion?

2 days 2 hours ago

In my code, I need to get the current view mode of the node to be able to pass it to be used as a block template suggestion.

The function I have set up is able to grab all available view modes, but I just want the current one. Possibly a condition that I haven't come across yet would do the trick?

function mytheme_theme_suggestions_block_alter(array &$suggestions, array $variables) { // Add template suggestions based on the current view mode and node type. if ($node = \Drupal::routeMatch()->getParameter('node')) { $view_modes = Drupal::entityQuery('entity_view_mode') ->condition('targetEntityType', 'node') ->execute(); foreach ($view_modes as $view_mode) { $view_mode = str_replace('node.', '', $view_mode); $suggestions[] = 'block--' . $node->getType() .'-'. $view_mode; } } }
Meaghan Florence

How to use PHPStorm to manage Drupal Workflow

2 days 2 hours ago

I am trying to set up a workflow for a Drupal site and I want to plan for ongoing updates and some development. It is a Drupal 10 site, and I am using PHPStorm. I have three versions of the site: Devel, where I test out changes, Deploy where I confirm it all locally, and Production, on a shared remote server.

My plan is to try out code on devel, upload it to deploy and then upload to production. I will also download user files and database changes from production down to devel to keep everything matched up.

I set this up on PHPStorm, and I can use PHPStorm's sync feature to upload the code changes (and download files and database changes that users make). When I "sync to deployed" I see files that are different from devel to deploy and production.

In addition to code changes that I have made, I see dozens of php and .htaccess files within the different sites/default/files/ (css, js, php, styles,sync) that PHPStorm has marked as changed. I suspect that these are dynamically-generated php files, and I can ignore them. That is, the deploy and production sites will create the php files on their own, without me uploading the changed php files. There are also a bunch of changed files in the "vendor" folder, they may have been created by Composer. Is that correct? I intend to use this workflow in the future to upload drupal core and module updates. Can I safely ignore changes to the files and vendor directories as long as I am careful to track changes to modules and theme templates? Is this whole thing a good idea? Thank you for your advice.

Len Lamberg

Pass data to hook_preprocess_html from custom module

2 days 3 hours ago

I'm trying to create a custom Drupal 7 module where it renders a custom page template. I want the data on /animals and /animals/getanimal to be in a custom HTML template.

After much searching and few successes, I've found that hook_preprocess_html works and that I can stop Drupal from loading the default template, but I'm struggling to pass data to my templates from the menu hook.

Is there a way to pass data from the menu hook to hook_preprocess_html, or is there another way where I can load my own custom template from the URLs in my custom module?

/** * Implements hook_menu() * @return mixed */ function animal_farm_menu() { $items['animals'] = array( 'title' => 'Discover animals', 'page callback' => 'getDiscover', 'page arguments' => array(), 'access callback' => TRUE, 'type' => MENU_NORMAL_ITEM, 'menu_name' => 'main-menu', ); $items['animals/getanimal'] = array( 'title' => 'all animals', 'page callback' => 'getAnimal', 'page arguments' => array(), 'access callback' => TRUE, 'type' => MENU_NORMAL_ITEM, 'menu_name' => 'main-menu', ); return $items; } function getDiscover() { $result = ['cat','dog','monkey','cow']; return $result; } function getAnimal() { $result = ['cat','dog','monkey','cow']; return $result; } /** * Implements hook_preprocess_html(). */ function animal_farm_preprocess_html(&$vars) { $node = menu_get_object(); $path = current_path(); // echo $path; // Add a new theme suggestion when viewing node's of mynodetype. if ($path == 'animals') { $vars['theme_hook_suggestions'][] = 'html__mynodetype'; $vars['data'] = [1,2,4,'monkey']; } if ($path == 'animals/getanimal') { $vars['theme_hook_suggestions'][] = 'animal_farm_discover'; $vars['data'] = [1,2,4,'monkey']; } } /** * Implements hook_theme(). */ function animal_farm_theme($existing, $type, $theme, $path) { $theme = array(); //Add our templates/html--mynodetype.tpl.php to the theme registry $theme['html__mynodetype'] = array( 'template' => 'html--mynodetype', 'path' => drupal_get_path('module', 'animal_farm') . '/templates', ); return $theme; }
user2075215

File validation when the file field isn't required

2 days 4 hours ago

I have a Drupal 7 custom form where the image or file field is not required. When the form is submitted and no file/image has been uploaded, I get the following errors.

Notice: Undefined index: storage in jobform_my_form_submit() (line 136 of /var/www/html/drupaltst/sites/all/modules/jobpackage/jobform.module).
Warning: Creating default object from empty value in jobform_my_form_submit() (line 141 of var/www/html/drupaltst/sites/all/modules/jobpackage/jobform.module). Notice: Undefined property: stdClass::$uri in file_save() (line 601 of /var/www/html/drupaltst/includes/file.inc).

Any help is appreciated!

function jobform_permission() { return array( 'add jobs module' => array( 'title' => t('Administer permission for your module'), 'description' => t('Some description that would appear on the permission page..'), ), ); } function jobform_menu() { $items = array(); //$items['jobform/form'] = array( $items['jobform'] = array( 'title' => t('Job Form Details'), 'page callback' => 'jobform_form', 'page arguments' => array('jobform_form'), 'access arguments' => array('add jobs module'), 'description' => t('My form'), 'type' => MENU_CALLBACK, ); return $items; } function jobform_form() { return drupal_get_form('jobform_my_form'); } function jobform_my_form($form, &$form_state) { $form['title'] = array( '#type' => 'textfield', '#title' => t('Title'), '#required' => TRUE, '#maxlength' => 100, '#prefix' => '<div class="titletle"><img src="/drupaltst/sites/default/files/images/title_icon.png" height="50" width="45">', '#suffix' => '</img></div>', '#attributes' => array( 'placeholder' => t('Enter a Short Title'), ), ); $form['descr'] = array( '#type' => 'textarea', '#title' => t('Description'), '#required' => TRUE, '#size' => 150, '#maxlength' => 5000, '#prefix' => '<div class="titledescr"><img src="/drupaltst/sites/default/files/images/descr_req_icon.png" height="50" width="45">', '#suffix' => '</img></div>', '#attributes' => array( 'placeholder' => t('Enter some specific details about the service you provide!'), ), ); $form['location'] = array( '#type' => 'textfield', '#title' => t('Enter Your Location'), '#required' => TRUE, '#size' => 75, '#prefix' => '<div class="titleloc"><img src="/drupaltst/sites/default/files/images/loc_icon.png" height="50" width="41">', '#suffix' => '</img></div>', '#attributes' => array( 'placeholder' => t('Where Can the Work Be Completed? (i.e. Online, City, State, Zip)'), ), ); //Image Field $form['image'] = array( '#type' => 'file', '#title' => t('Upload a Photo'), '#description' => t('Allowed extensions: gif png jpg jpeg'), '#prefix' => '<br><div class="titlefile"><img src="/drupaltst/sites/default/files/images/upload_image_icon.png" height="50" width="41">', '#suffix' => '</img></div>', ); $form['submit'] = array( '#type' => 'submit', '#value' => 'Submit', '#prefix' => '<br><div class="titlesubmit">', '#suffix' => '</div>', ); return $form; } function jobform_my_form_validate($form, &$form_state) { $file = file_save_upload('image', array( // Validates file is really an image. 'file_validate_is_image' => array(), // Validate extensions. 'file_validate_extensions' => array('png gif jpg jpeg'), )); // If the file passed validation: if ($file) { // Move the file into the Drupal file system. if ($file = file_move($file, 'public://images/')) { // Save the file for use in the submit handler. //$form_state['image'] = $file; $form_state['storage']['image'] = $file; } else { form_set_error('image', t("Failed to write the uploaded file to the site's file folder.")); } } else { form_set_error('image', t('No file was uploaded.')); //$file = file_move($file, 'public://images/title_icon.png'); } } function jobform_my_form_submit($form, $form_state) { $file = $form_state['storage']['image']; // We are done with the file, remove it from storage. //unset($form_state['image']); unset($form_state['storage']['image']); // Make the storage of the file permanent. $file->status = FILE_STATUS_PERMANENT; // Save file status. file_save($file); global $user; $na = 0; $istat = 1; db_insert('job_mp_catalog') ->fields(array( 'user_id' => $user->uid, 'title' => $form_state['values']['title'], 'descr' => $form_state['values']['descr'], 'location' => $form_state['values']['location'], 'image' => $file->fid,)) ->execute(); drupal_set_message("successfully saved "); //Example: //drupal_goto("user/".$user->uid."/edit"); drupal_goto("content/test-page"); //drupal_set_message("successfully saved Job!"); }
Keith

Exposed filter for data and select field

2 days 5 hours ago

I spent all weekend trying to make this work, and couldn't figure it out.

How do I create a views exposed filter for date and a text list on a given node?

My setup - I have a view that is exposed as JSON with a task_name field, a date field, and a status field.

I have the date module installed in both Drupalgap as well as Drupal, and I'm able to get that to display correctly.

I've tried creating a select list for day, month and a year, as well as task status, and this seems clunky (four select lists takes up quite a bit of room - and I can't figure out how to collapse them - perhaps some sort of "collapse format"?)

But even if I do create them, there seems to be no way to have an interaction between them and the view content object. I tried grabbing the values of the select lists from the path of the views object, but there seems to be no way to do that.

My views code looks like this, almost an exact copy of the beer example:

function task_list_page() { try { var content = {}; content['task-list'] = { theme: 'view', format: 'ul', path: 'tasks.json', row_callback: 'task_list_page_row', empty_callback: 'task_list_page_empty' }; return content; } catch (error) { console.log('task_list_page - ' + error); } }

What would I do to this to create an exposed filter for date and status, both of which are columns in the view? How would I make this filter compact and perhaps collapsible?

Jack Ryan

How to combine two batch operations for views data export into one?

2 days 6 hours ago

I have been using a custom module that was posted here:

https://www.drupal.org/node/1875456

I slightly modified this module and created two copies of it, as I have two views and planning to add third one but it currently doesn't work properly so let me explain:

dvm_reports module#1 for Denmark

function dvm_reports_views_data_export_batch_alter(&$batch, &$batch_redirect) { $view = views_get_view($batch['produkty_denmark_xml']); // Add in another operation that will store the file on the server in a location // of our choosing. $batch['operations'][] = array( 'dvm_reports_views_data_export_batch_finish', array($batch['eid']), ); } function dvm_reports_views_data_export_batch_finish($eid) { $export = views_data_export_get($eid); $view = views_data_export_view_retrieve($eid); $view->set_display($export->view_display_id); $view->display_handler->batched_execution_state = $export; $view->display_handler->remove_index(); // Get path to temp file $temp_file = $view->display_handler->outputfile_path(); file_unmanaged_copy($temp_file, 'public://denmark.xml', FILE_EXISTS_REPLACE); }

It starts to generate the file correctly when I go to domain.com/denmark

dvm_reports module#2 for Sweden (I copied the denmark module and renamed it from "dvm_reports" to "dvm_reports2")

function dvm_reports2_views_data_export_batch_alter(&$batch, &$batch_redirect) { $view = views_get_view($batch['produkty_json']); // Add in another operation that will store the file on the server in a location // of our choosing. $batch['operations'][] = array( 'dvm_reports2_views_data_export_batch_finish', array($batch['eid']), ); } function dvm_reports2_views_data_export_batch_finish($eid) { $export = views_data_export_get($eid); $view = views_data_export_view_retrieve($eid); $view->set_display($export->view_display_id); $view->display_handler->batched_execution_state = $export; $view->display_handler->remove_index(); // Get path to temp file $temp_file = $view->display_handler->outputfile_path(); file_unmanaged_copy($temp_file, 'public://produkty.json', FILE_EXISTS_REPLACE); }

it starts to generate the file correctly when I go to domain.com/sweden

Problems:

I would like to combine those two modules into one but I don't know how to do it.

Please advice if you can

Gabe H

Automatic Node Expire / Unpublish with Renew Option

2 days 7 hours ago

I have a classifieds site and would like to have a node expire after 45 days (unpublished), no matter how many times the user edits and saves the node. However after the node expires, the user has the ability to renew (publish) for another 45 days. I would like the time to be strictly 45 days with simple a renew button when it is expired.

Here is the workflow:

  1. User creates node
  2. Email is sent to node author indicating successful post.
  3. Node is automatically expired 45 days later.
  4. Email is sent to node author indicating expired post.
  5. User has the ability to easily renew ad (expiry date is 45 days later yet again)
  6. Email is sent to node author indicating renewed post (different from step 2)

I would also like to have a countdown for the days remaining until the expiry date.

I have successfully built steps 1-4 using rules only, however the rules are based on the event 'After saving new content', which means when a node is republished/renewed the rules do not follow because it is not new content.

I have also tried using the Scheduler module to set the unpublish date but cannot figure out how to enable renew only after it has expired.

I have also tried Auto Expire but I think it only gives the ability to renew before it expires, not after.

chrisck

Bootstrap sub-theme override CSS

2 days 8 hours ago

I just set up an new Drupal 8 website. I was used to use CSS injector on Drupal 7, but since the module is not ready yet, and I thought I'd better start with subthemes, I tried to create a new Boostrap subtheme. I used the CDN method, activated it in my admin panel, but when I try to override CSS by creating CSS styles in css/style.css, nothing work. In Drupal 7 with CSS injector, my main difficulty was to find the proper class. So I tried a lot of different possibilities, copied/paste CSS from original files in Bootstrap. Nothing works.

Have anybody already tried to create a sub-theme with Bootstrap? Did overriding CSS work?

I looked at the CSS file link, it's loading lumen theme nicely. I tried to change h2 color in this file: themes/bootstrap/css/3.3.5/overrides-lumen.min.css and it works...Clearly, seems that style.css is not used...

Ryan

Display field collection items by using twig

2 days 9 hours ago

I'm using the field collection module in Drupal 8 to encapsulate event informations so I've got a field collection with six sub fields (place, starting time, etc.).

In my twig template field--field-event.html.twig, I'd like to extract each item of the field collection and bring it separately to the view - but I can't figure it out. What's the right way to get the content of each field collection item and process it individually?

{% for item in items %} {{ kint(item) }} {% endfor %}

Iterating through the field collection with above code gives me an impression that the field collection items have got a content (with #markup) and attributes but how do I get to the core/values of the field items?

docfnord

Order total field, transactions and balance

2 days 10 hours ago

In drupal commerce, using the commerce payment payment module, I would like to display the amount paid and order balance in paid order like on the example below.

Subtotal ------------- 20

TAX --------------------- 3

Total ------------------ 23

Amount paid ----- 23

Order balance ---- 0

How could I achieve this ?

I'm close to get what I want. I created a module
I still have an issue : I don't know how to get the order_ID ?

<?php /** * @file * Commerce Order Total and Balance Module. */ // implement hook_commerce_price_formatted_components_alter() function commerce_order_total_and_balance_commerce_price_formatted_components_alter(&$component_types) { // TO DO : retreive the order ID (or the order object) $order_id = 142; // load the order $order = commerce_order_load($order_id); // get the balance $balance = commerce_payment_order_balance($order); // rename and reorder component_type $component_types['base_price']['title'] = 'Total HT'; $component_types['base_price']['weight'] = -90; // rename and reorder component_type $component_types['tax|20_vat']['weight'] = -80; // rename and reorder component_type $component_types['commerce_price_formatted_amount']['title'] = 'Total TTC'; $component_types['commerce_price_formatted_amount']['weight'] = -50; if ($balance['amount'] <= 0) { // we display total payments and order balance only if order balance is zero or less // add component_type "total_paid" $component_types['total_paid']['title'] = 'Montant pay&#233;'; $component_types['total_paid']['weight'] = -40; $component_types['total_paid']['price']['currency_code'] = $component_types['commerce_price_formatted_amount']['price']['currency_code']; $component_types['total_paid']['price']['amount'] = $component_types['commerce_price_formatted_amount']['price']['amount']-$balance['amount']; // add component_type "order_balance" $component_types['order_balance']['title'] = 'Solde'; $component_types['order_balance']['weight'] = -30; $component_types['order_balance']['price'] = $balance; } }
Thibaut51

Alter title link in taxonomy view mode

2 days 11 hours ago

Under /admin/structure/taxonomy/my_vocabulary/display/entity I've got a view mode "entity". For this view mode, I would like to alter the way the link in the title field is built (the title is replaced by a real field instance due to title module): the link should be rebuilt into an anchor link like this: <a href="#term-ID>Title</a>, where term-ID is replaced with the actul term ID of the term. How can I achieve this by a custom module or by a template function? Are render arrays good for this? Here's a screenhot of the admin page.

Madam Adam

Subscriptions in Commerce Stripe

2 days 12 hours ago

I use the Commerce Stripe module to make charges on my website, but I need to be able to subscribe through Stripe, and I have no idea how to do it. The charges I make and without problem but I would need someone to show me the way on how to change the charge to subscription through Commerce Stripe. Thank you.

Rafa

Access to core comment preprocess variables in a custom comment layout twig template?

2 days 13 hours ago

In Drupal 8 I have a custom comment type and when I use the default core comment.html.twig to render the comments then variables like 'new_indicator_timestamp' and 'parent' get rendered as expected. But if I switch to using a custom layout (via layout_plugin and display suite) and copy across the relevant twig template code for those core comment preprocess variables into my own custom layout then they don't work.

What do I need to do to ensure that the comment.module template_preprocess_comment() variables are available to my custom comment layout?

inteja

Site errors out when trying to create a subtheme based on Classy

2 days 14 hours ago

I'm creating a custom theme in Drupal 9 and am trying to use classy as my subtheme but get the following error:

The website encountered an unexpected error. Please try again later. Drupal\Core\Theme\MissingThemeDependencyException: Base theme classy has not been installed. in Drupal\Core\Theme\ThemeInitialization->getActiveThemeByName() (line 122 of core\lib\Drupal\Core\Theme\ThemeInitialization.php). Drupal\Core\Theme\ThemeInitialization->initTheme('custom_theme') (Line: 406) Drupal\Core\Theme\ThemeManager->initTheme(Object) (Line: 96) Drupal\Core\Theme\ThemeManager->getActiveTheme() (Line: 214) Drupal\Core\Theme\Registry->init(NULL) (Line: 258) Drupal\Core\Theme\Registry->getRuntime() (Line: 194) Drupal\Core\Entity\EntityViewBuilder->getBuildDefaults(Object, 'full') (Line: 61) Drupal\node\NodeViewBuilder->getBuildDefaults(Object, 'full') (Line: 157) Drupal\Core\Entity\EntityViewBuilder->viewMultiple(Array, 'full', NULL) (Line: 123) Drupal\Core\Entity\EntityViewBuilder->view(Object, 'full') (Line: 98) Drupal\Core\Entity\Controller\EntityViewController->view(Object, 'full', NULL) (Line: 66) Drupal\node\Controller\NodeViewController->view(Object, 'full', NULL) call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23) Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 705) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Below is my theme.info.yml info:

name: Custom Theme type: theme description: "This is a custom theme for the company" version: "1.0.0" core: 8.x package: "Custom" core_version_requirement: ^8 || ^9 base theme: classy # libraries: # - custom_theme/bootstrap_cdn # - custom_theme/global-styling regions: search: Hidden Search Bar branding_navigation: Branding & Main Navigation header: Header primary_menu: Primary menu secondary_menu: Secondary menu content: Content footer: Footer

Why is it saying that 'Base theme classy' isn't installed? I've never run into this issue before. Does it have something to do with Drupal 9? (This is my first time starting from scratch in D9)

I see that classy is in the core files so not sure why I'm getting this error?

Any help/suggestions?

EDIT: I'm using Acquia Dev Desktop if that makes any difference.

ACanadianCoder

Can create directories but can't upload files

2 days 15 hours ago

When I try to upload a file with a file field, Drupal creates a sites/default/files/2023-10 directory, but can't upload the file. I see this validation error in the UI: "File upload error. Could not move uploaded file." And I see a similar notice in the Drupal log: "Upload error. Could not move uploaded file test.txt to destination public://2023-10/test.txt."

In admin/config/media/file-system, my public file system path is set to sites/default/files. There are no errors on the status page indicating a permissions problem.

If I delete the files directory altogether, and then save the form at admin/config/media/file-system, Drupal creates sites/default/files and sites/default/files/php.

What are the possible reasons Drupal can create directories inside of sites/default/files, but can't upload files?

Drupal version: 9.5.11 Web server: IIS 10 PHP 8.1.21
arnoldbird

Error when uploading file through Drush on S3 volume

2 days 15 hours ago

I am using Amazon S3 volume to store the node's attachment. I keep having the following message:

file_put_contents(public:///.htaccess): failed to open stream: "DrupalPublicStreamWrapper::stream_open" call failed file.inc:494 [warning] WD security: Security warning: Couldn't write .htaccess file. Please create a .htaccess file in your public:// directory which contains the following lines: # Turn off all options we don't need. [error] Options None Options +FollowSymLinks.....

I tried chmod 777 on private (sites/default/files/private) public (sites/default/files) folders without any success.

Is it because amazon S3 and AWS/SDK are installed. It works weel anyway : my files are created on S3 volumes. But the message is annoying.

Any ideas ?

Thanks

kha

How to get parent node values on inline entity form hook alter?

2 days 17 hours ago

I am using inline entity forms to create a paragraph in a node form. When I add a node I want the title of the node form to be copied to the paragraph when I click on "Add paragraph". I use hook_inline_entity_form_entity_form_alter to prefill the title field. That works, only I can't get the values from the node form. Not with the below code.

function example_forms_inline_entity_form_entity_form_alter(&$entity_form, &$form_state) { $node = $form_state->getFormObject()->getEntity(); if ($node->getType() == "task" && $entity_form['#bundle'] == "improvement") { \Drupal::logger('Form state values')->debug("<pre>" . print_r($form_state->getValues(), TRUE) . "</pre>"); \Drupal::logger('Node values')->debug("<pre>" . print_r($node, TRUE) . "</pre>"); $entity_form['title']['widget'][0]['value']['#default_value'] = 'This is Jessica'; } }

Can someone help me solve this?

Jessica IX

How can I programmatically delete a custom menu?

2 days 18 hours ago

I'm writing a hook_deploy_N that moves a bunch of menu items from a deprecated custom menu to some newer ones. So far, so good. After moving the items, I want to delete the old menu, but can't figure out how. \Drupal\Core\Menu\MenuTreeStorage has a delete function that may be what I'm looking for, but the \Drupal\Core\Menu\MenuTreeStorage object is housed inside the \Drupal\Core\Menu\MenuLinkTree, which I can at least load, but has protected status, and I don't see a way to get to it. Plus, I'm not not 100% convinced that's what I want any way.

beltouche

Use form_alter to change description under reset password field for user_pass form

2 days 19 hours ago

I'd like to change the text below the reset password field. I took a look at this answer, and it talks about changing the button, but I need a bit of help to change the text.

Here is the debug output and it looks like I need to access #description

[name] => Array ( [#type] => textfield [#title] => E-mail [#size] => 60 [#maxlength] => 254 [#required] => 1 [#default_value] => [#description] => A password reset message will be sent to your e-mail address. [#input] => 1 [#autocomplete_path] => [#process] => Array ( [0] => ajax_process_form )

This is how I would change the button:

function footheme_form_alter(&$form, &$form_state, $form_id) { if($form_id == 'user_pass') { $form['actions']['submit']['#value'] = t('reset password'); print "boom"; } }
Dan

How to link an image with a PDF?

2 days 20 hours ago

Actually, I have a content type with 2 fields, image field (multiple) which will contain some pictures and an attachment field (accept only one file) which is file of type PDF.

I have a view where I put my gallery and each picture opens in a colorbox. The PDF file (actually global pdf for all images) is only a button.

There was a change and the new requierement is: "For every image that goes up, must have its own PDF. Every image should have its own associated file."

Another requirement is, if the image is opened on a colorbox also appears a button (in the colorbox) which displays the PDF associated with the corresponding image.

Any idea??? Sorry for my bad english.

Dvex
Checked
18 hours 16 minutes ago
most recent 30 from drupal.stackexchange.com
Subscribe to Drupal StackExchange feed