texts: feed import module: is it possible to have a feed importer without unique field

texts:
I'm using Commerce Kickstart 2.

The SKU field of my products is automatically generated in relation with a serial field that I've created (Serial field module). That was done with the appropriate token generated with the serial field attached to automatic SKU generation. So I want to import my products with Feed Import module without to have a unique field configured, because the SKU will be automatically generated.

Is it possible to setup a feed importer without unique field?

Sorry about my bad English.


texts:
I created a text field in my "content type". as I do with php to access this value?
I would print it in a similar way:

 <?php print $submitted; ?>

in node.tpl.php and prevent it from being printed in an automatic way.

EDIT

I put this command in the file node.tpl.php:

<?php print $field_nazionalita_1; ?>

the result is:

Array([und] => Array(
   [0] => Array(
      [value] => francia
      [format] =>
      [safe_value] => francia
   )
  )
)

the result that I want is:
francia

but only if I inserted a value in the field.

I know little php, you can help me?


texts: Unable to set a default value for a CCK field

texts:
I am trying to set a default value for a CCK Multi Select field tried with PHP code

return array(
  0 => array('value' => "ONE"),
  1 => array('value' => "TWO"),
);

and without PHP Code by just selecting the values (after adding to Allowed Values) with required ON & OFF but still nothing gets selected in select drop down.


texts:
In my theme-settings.php i want to set text format to 'filtered_html' and display in page.tpl.php.

I used this code to display text area:

$form['options']['description'] = array(
'#type'          => 'textarea',
'#title'         => t('Description'),
'#default_value' => theme_get_setting('description'),
);

And display it using <?php print strip_tags(theme_get_setting('description')); ?> in page.tpl.php

How do i set the textarea to use 'filtered_html' format


texts: Is it possible to migrate data into multiple translations of entities?

texts:
I'm running a multilingual migration of events (which are stored as nodes) that have keywords on them where there are keywords (stored as terms). The keywords  should be stored in a multilingual tags vocabulary.

The source is a REST API, and what I have for the keyword data looks like this:

array (
 'id' => 'yso:p360',
 'alt_labels' =>
 array (
 ),
 'created_time' => '2014-06-23T11:37:29.198000Z',
 'last_modified_time' => '2014-06-23T11:37:29.198000Z',
 'aggregate' => false,
 'deprecated' => false,
 'n_events' => 11709,
 'data_source' => 'yso',
 'image' => NULL,
 'name' =>
 array (
   'fi' => 'kulttuuritapahtumat',
   'en' => 'cultural events',
   'sv' => 'kulturevenemang',
 ),
 '@id' => 'https://api.hel.fi/linkedevents/v1/keyword/yso:p360/',
 '@context' => 'http://schema.org',
 '@type' => 'Keyword',
)

Is there some way to use for example EntityGenerate to create all the translations of the tags when importing the original languages of the events that has these tags?

Note:

I would like to avoid migrating all the keywords first. We only import a subset of the events, and we are only interested in the keywords that are used by those events.

The normal way of D8 migrations with multilingual sources is to create a configuration for each translation. This doesn't work in our case, as I chose to use entity_generate for the tags. If you have another suggestion, I am interested.


texts: Admin UI doesn't see the correct PHP version

texts:
I have a local development site on Ubuntu and currently my system has PHP 7.4 installed and I can see Drupal site using the correct version in terminal using drush st but if I browse to Admin UI and check the PHP version in status page it is showing different version.
In case it helps Initially the site was setup on PHP 7.2 later on PHP version is updated on the system.

drush @local.local st

Drupal version   : 8.9.0
Site URI         : http://local.d8site.local
DB driver        : mysql
DB hostname      : localhost
DB port          : 3306
DB username      : drupal
DB name          : d8site_local
Database         : Connected
Drupal bootstrap : Successful
Default theme    : bartik
Admin theme      : seven
PHP binary       : /usr/bin/php7.4
PHP config       : /etc/php/7.4/cli/php.ini
PHP OS           : Linux
Drush script     : /var/www/local.d8site.local/vendor/drush/drush/drush
Drush version    : 10.2.2
Drush temp       : /tmp
Drush configs    : /var/www/local.d8site.local/vendor/drush/drush/drush
                  .yml
                  /var/www/local.d8site.local/drush/drush.yml
Install profile  : standard
Drupal root      : /var/www/local.d8site.local/web
Site path        : sites/local
Files, Public    : sites/local/files
Files, Temp      : /tmp

php --version
PHP 7.4.9 (cli) (built: Aug  7 2020 14:29:36) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.9, Copyright (c), by Zend Technologies
    with Xdebug v2.9.6, Copyright (c) 2002-2020, by Derick Rethans


texts:
I have a gallery, created as a view:

http://hotelcentralpark.ro/gallery/2

Now the titles are links to the pages. And  images have lightbox effect.

I want the links to activate lightbox of the appropriate image. But there are no settings for that in the admin panel.

Here are the settings for the image field:

Settings for the header field in the control panel:

How can I set the link to act as lightbox?

Here is the image content type structure:


texts:
Could you please help me with the following task? I need to make the existing field (name Clarify, type select - "clarification required/clarification isn't required") to be editable from display view (not on the Edit tab) and I need to place this field next to Comment field (see the screenshot).

I'm trying to use hook_alter_form in the following way, but with no luck. I know the below code is wrong and I need a little help to know which way to go.

function custom_form_alter(&$form, $form_state, $form_id) {
  if ($form_id == 'comment_node_support_ticket_form') {
    $form['field_clarify'] = array(
      '#type' => 'select',
      '#title' => 'Clarify',
    );

    $form['#validate'][] = 'custom_support_comment_submit';
  }
}

function custom_support_comment_submit($form, &$form_state) {
  $node = node_load($form_state['values']['nid']);
  $node_wrapper = entity_metadata_wrapper('node', $node);
  $node_wrapper->field_clarify->set($form_state['values']['field_clarify']);
  $node_wrapper->save();
}


texts: Receiving Access Denied with altered CRUD paths in ECK

texts:
I have altered the CRUD paths for entity types and bundles created with Entity Construction Kit.  The change propogates correctly, all views which use the ECK provided views fields (Link, Edit, Delete) are now using the correct URL.

The issue is when trying to hit those URL's, the page is always access denied.  What I have found in my troubleshooting:

The menu is built within eck.entity.inc.  I have used the following test code, inserted at line #93

if ($bundle->name == 'inventory_item' && $action_label == 'Edit') {
  print_r($access_args);
  die();
}
// result = Array ( [0] => edit [1] => inventory_item [2] => inventory_item [3] => 5 )

Note that the $access_args does contain the correct entity id (index 3 in the result array).
The menu access callback is eck__entity_menu_access() which is found in eck.module and I have included the following there, inserted at line 762:

if ($action == 'edit' && $bundle_name == 'inventory_item') {
  print_r(func_get_args());die();
}
// result = Array ( [0] => edit [1] => inventory_item [2] => inventory_item [3] => )

Note that index 3 ($entity_id) is null now.

I can't figure out where the entity id is lost.  I don't think it matters, but I did check the loader, eckentity_load() and it is loading the correct entity.

Any ideas why the entity id is not making it to the access callback?


texts: During database updates the schema of any module could be out of date

texts:
I try to well understand Update versions API functions.
I globally understand the concept, but I have some doubt.

In fact Drupal makes no verification about the N version number use in the name of a simplified function _update_N_mymodule_my_function(). N can be what ever we want (even a string) ?
More, even the whole name of function can be named in fact e.g "toto()" ? Drupal makes no verification, and names used for functions simplified are just for convenience. Correct ?


texts: How to use Views PHP to code if a view exists and has content then echo...

texts:
I have a view displaying a list a menu of all the content for a node. It contains a list of all the fields and views on the page, with the output rewritten as a link eg link to field A .
I can do this fine for each field but I also have a view 'teachers' exposed as a block. If the view has content I want to have a link to it in the menu.
I'm trying to use Views PHP to code if the view has content, echo ''
What function do I call to see if the view exists and has content?
I've tried if(views_get_view('teachers) == TRUE){ echo "";} but this always returns TRUE even if there is no content for that view for a specific node.

I want to do something similar to


texts:
I need to switch user's language programmatically. The issue is I don't want it as an url part, and unable to switch it even with the regular language switcher block.

What I've try:

admin/config/regional/language/detection: Disable url, Enable Session
Now the Language Switcher core block adds ?language= to the current path. But this setting does not persist between pages, and does not appears in the session.
manual setup of $_SESSION['language'] does nothing
\Drupal::languageManager()->setConfigOverrideLanguage($language_manager->getLanguage($langcode)) does nothing

Drupal version is 8.beta2


texts: How to show last login time and user email to all authenticated users?

texts:
I have created a view for user profile page. I also want to show the user's current email address and last login time. It is working fine for admin but email and last login time is not visible to authenticated user on front end.
I have granted the View User Information permission to authenticated users but no success after that too.
Is it a permission issue or something else ?
What I am missing ?


texts: How do I display a sorting button in views?

texts:
I need to create functionality so that the user can switch between different sort/filter behaviors in a view.  Hopefully, without loading a different page.

For example, I have a list of projects on my site and I want buttons that the user can click to hide projects that aren't of a specific type.  ie: show only print, show only web, show only video, etc.

Is there any way to do this asynchronously with views, rather than custom scripting stuff with jquery or linking to totally different pages?


texts: How do I add authentication to a POST request on an implementation of hook_menu?

texts:
I have a list of lesson plans, sorted by category. Underneath each category, I have a link called "Add new lesson/category/root term".

I would like it so that when the user clicks on "Add new category" or "Add new root term", they are prompted with a message box to get the name of the new term to add. Then, that message box will make an ajax call to mysite.com/add-new-term, with the name of the new term as a POST argument.

I know how to make an HTTP POST request using jQuery.post(). I know how to implement hook_menu() to enable requests to mysite.com/add-new-term. And I know how to use PHP's superglobal array $_POST to get the data from the request.

BUT, I don't know how to add user authentication to the request.

How can I ensure that only logged-in admins can make these requests? I don't want just any random person on the web to be able to create new terms.


texts: Pass field value of original node in webform

texts:
I'm using Drupal 8.7.8 and Webform 5.4.0. I have multiple section nodes that are displayed on course nodes. These are 2 different content types.

I'm adding webforms to sections, via the twig file conditionally (not all sections) with {{ drupal_entity('webform', 'my_form_id') }} and I need to pass the value of field_code of the section into a hidden field on the webform.

Once the form is rendered on the course page, the field_code value passed belongs to the course node rather than the section. How can I access the field_code value on the section?

I tried adding a hidden field with this token as the default [webform_submission:node:field_code:value], which works when I test the form on the section, but when I test the form on the course (where the user will access it) I'm getting the field_code value of the course.

What's the best way to handle this? Is there a way to set the source entity to the content type that the form is on? Please let me know if I need to add more info.

Thanks!


texts: Pass Preprocess Values From Custom Module to Custom Form

texts:
My use case:

I would like to create a unique textfield per region in a custom form.

MYMODULE/MYMODULE.module:

function MYMODULE_preprocess_region(&$variables) {

    foreach (array($variables['elements']['#region']) as $key) {
        drupal_set_message($key);
    }

}

MYMODULE/src/form/MyModuleForm.php:

protected function getEditableConfigNames() {
    return [
        'module_config.module_config_settings',
    ];
}

public function buildForm(array $form, FormStateInterface $form_state) {

    $config = $this->config('module_config.module_config_settings');

    //build this...
    $form['region_name'] = array(
        '#type' => 'textfield',
        '#title' => t('Form Item Title),
    );

    return parent::buildForm($form, $form_state);

}

What is the appropriate way to pass variables/info from the .module file to the .form?

*Note: I have a fully functioning form, hopefully I am showing enough of it to illustrate my focus.


texts:
Standard drupal field types like Strings, Numbers, Dates and Taxonomies can be defined as Sortable in Views with Format: Table.

But more complex fields like Hierachical Taxonomies and Paragraphs or paragraphs don't have a checkbox to make them Sortable.

Is there any way to make them sortable using Views interface or do I have to make a custom plugin  Tablesort with EntityQuery?


texts:
I'm learning how to implement a custome Views 3 field handler.

Using the following handler code:

class views_handler_filter_sub_nodes extends views_handler_field_custom{

    function options_form(&$form, &$form_state){

        drupal_set_message('My customer handler is responding', 'warning');

        parent::options_form(&$form, &$form_state);
    }
}

I get the following error, repeated twice:

Deprecated function: Call-time pass-by-reference has been deprecated in _registry_check_code() (line 3119 of /var/www/My-Site/includes/bootstrap.inc)

I have removed the & symbols from the arguments. The errors go away but so do all the configuration fields in my View component, as illustrated below:

Can anyone help, please?


texts: Filter is Stripping URL with custom scheme

texts:
There are times we are using custom schemes for URLs and storing them in Drupal 6.

The href attribute values are getting stored in the db properly.

So,

gets stored as it's written. However, when viewing the page the unknown scheme gets stripped so it outputs:

I've disabled all filters in the full HTML input format and have returned out of my hook_nodeapi function in my custom module, and disabled the WYSIWIG, and still the scheme gets stripped.

Any ideas where this might be happening?


texts: Auto resize iframe from different domain?

texts:
I already post a question regarding this issue but I haven't got any solid answer(s). Since we are not allowed to communicate inside the iframe due to "Same Origin Policy", which I almost give up due to all responses that there is no way to re-size the height of an iframe coming from different domain.

Being eager to solve the problem I searched for solutions and I found this easyXDM which looks like a solution to my problem. Any of you guys have an idea about this. In addition to that I read this post also.

I also tried this one but it keep refreshing the page and keep looping to add height. Looking forward to hear from you guys.


texts:
The Feeds module is still in development for D8, but I'm trying to test it. I can set up Feed Types, but the actual imports do not seem to trigger.

Does anyone know how to do this on Drupal 8?


texts: Do non-enabled modules affect performance?

texts:
Does having Drupal modules present, but not enabled have any effect on the performance of a Drupal site?

To put it another way, would removing disabled modules on a Drupal site have a positive affect on performance?


texts: CSV Feed importer rounds of Float values while importing

texts:
I am using a Feedimporter to import values like this

-122.385170161038

in to a text field. It is rounding off the value to

-122.3851702

Not sure why? Any assistance will be helpful.

Thanks.


texts: Views won't display unpublished nodes when explicitly told to

texts:
My plan is to have a custom page view at blog/% so bloggers can see their own unpublished posts.

If I remove everything except these:

Filter criteria
Content: Type (= Blog entry)
Content: Published (No)

Contextual filters
Content: Author uid

I still can't see the unpublished nodes without making that user an admin. (IE: I log into uid 12 and go to blog/12 - see no nodes. Make uid 12 admin - see 1 unpublished node)

Edit: A look at the SQL shows for admin:

SELECT node.title AS node_title, node.nid AS nid, node.changed AS node_changed, node.created AS node_created
FROM node node
WHERE (( (node.uid = :node_uid ) )AND(( (node.type IN (:db_condition_placeholder_0)) AND (node.status = :db_condition_placeholder_1) )))
ORDER BY node_created DESC LIMIT 10 OFFSET 0

And for normal user:

SELECT node.title AS node_title, node.nid AS nid, node.changed AS node_changed, node.created AS node_created
FROM node node
WHERE (( (node.uid = :node_uid ) )AND(( (node.type IN (:db_condition_placeholder_0)) AND (node.status = :db_condition_placeholder_1) )))
AND ( EXISTS (
  SELECT na.nid AS nid
  FROM node_access na
  WHERE (( (na.gid = :db_condition_placeholder_2) AND (na.realm = :db_condition_placeholder_3) )OR( (na.gid = :db_condition_placeholder_4) AND (na.realm = :db_condition_placeholder_5) )OR( (na.gid = :db_condition_placeholder_6) AND (na.realm = :db_condition_placeholder_7) ))AND (na.grant_view >= :db_condition_placeholder_8) AND (node.nid = na.nid) ))
ORDER BY node_created DESC LIMIT 10 OFFSET 0

Obviously there's a massive amount more SQL for normal users than admins despite my not having put anything related to node_access in there. What is views automatically doing and how can I stop it?


texts:
I am performing a hook_node_validate() and would like to add a new field (e.g. a textfield) during the processing of this function.  Is this possible?  If so could someone let me know how to do it.  I am tried to following so far w/ no luck:

function hook_node_validate($node, $form, &$form_state) {
    $form['content_type_node_form'] = array(
        '#title'    => t('Phone'),
        '#type'     => 'textfield',
        '#required' => TRUE,
    );
    form_set_error('time', t('Stop submission to add new field'));
}

Thanks,
Derek


texts: Is complex field validation possible with WebForm?

texts:
WebForm is a very nicely done module, but (at least at first glance) it seems to lack some things that I expect to need.

Specifically, I'd like a way to specify more complex field requirements than just a boolean.  For instance, what if I have a form with an e-mail address field and a telephone field, and I want the user to be required to enter at least one of the two.  In other words, if they enter an e-mail address, they don't need to enter a phone number; and if they enter a phone number, they don't need to enter an e-mail address.

Is this possible with WebForm?


texts: How can I hide and print a field in my tpl.php?

texts:
I'm using kickstart 2. I have product variation types and a content type for each product. field_desc under the content type manage fields, I have managed to hide and print render successfully in my node--product--type.tpl.php.

However, I have another field called field_spec which is a variation type field rather than a content type field. when I use the following codes in my tpl.php to hide and print the field_spec, this field is not hidden or printed where I want.

I use the following codes to hide and print both field_spec and field_desc however field_spec isn't hiding whereas field_desc is:

  <?php
    hide($content['field_desc']);
  ?>

 <?php
 print render($content['field_desc']);
 ?>

I have checked that field_spec is spelled correctly, I have cleared caches etc. however I cannot hide and print field_spec.

Is this something to do with the fact field_desc is a content type field whereas field_spec is a variation type field?

Thank you


texts: Apply multiple Content Type filters to Search Block Form in hook_form_alter()

texts:
I'm trying to figure out how to apply multiple content type filters to the search results of the Search Block Form (not the normal search form). I've successfully filtered by current language and ONE content type. So far, here's what I have:

function mytheme_form_search_block_form_alter(&$form, &$form_state) {
  $manager = \Drupal::languageManager();

  $form['advanced-form'] = [
    '#type' => 'hidden',
    '#value' => 1,
  ];
  $form['f[0]'] = [
    '#type' => 'hidden',
    '#value' => 'language:' . $manager->getCurrentLanguage()->getId(),
  ];
  $form['f[1]'] = [
    '#type' => 'hidden',
    '#value' => 'type:Insight',
  ];
}

There doesn't appear to be any documentation about adding filters this way. But I did find this: NodeSearch::buildSearchUrlQuery. It appears that one should somehow be able to use OR and Negation in this, but I just can't figure it out.

I've tried this:

$form['f[1]'] = [
    '#type' => 'hidden',
    '#value' => 'type:Insight OR type:Event',
];

This just filters by the last one listed. I also tried this:

$form['f[1]'] = [
    '#type' => 'hidden',
    '#value' => 'type:Insight OR Event',
];

And this:

$form['f[1]'] = [
    '#type' => 'hidden',
    '#value' => 'type:["Insight","Event"]',
];

And none of these were working to filter in (or out) multiple content types.

Any help would be greatly appreciated. Or just pointing me to some documentation on using filters this way. Thanks.


texts: Getting a list of nodes of a certain type sorted by number of votes

texts: I would like to get a list of nodes of a certain sorted by votes (voting api) in one of my modules. Is there an entityFieldQuery that could do this? If not, is there a sql query I could use that might accomplish this task?


texts: How to check progress of sql-sync that hangs up?

texts:
I run:

drush sql-sync @mysite.es.remote @mysite.es.local

then I hit Yes to continue then command completely hangs up for ever. Meanwhile I checked phpMyAdmin and it seems that it's synced my local database with remote but it's still missing some tables.

Is there any way how to check progress of sql-sync?


texts: Login form on restricted page doesn't accept login credentials

texts:
I took over a d7 page from another dev to whom I currently don't have contact. Now I'm digging through the different configurations and settings etc. trying to fix various minor issues. One of the issues is a strange behavior that prevents users from logging in in case they access a restricted node. In detail:

The website I'm working on has a restricted area "intranet" which is only accessible for logged in users. Users that are not logged in trying to access the "intranet pages" see only the login form with the message "You have to be logged in to access this page". So far so good.

But when I (not logged in) then actually enter the correct login credentials on  the form that appears on those restricted nodes, I'm just getting the error message "You have to be logged in…" again, together with the login form. Logging in through the regular login page "/login" works perfectly fine.

I hope somebody knows a way around this problem? Any pointers appreciated…


texts: Is it possible to setup reports per individual user when using the Commerce Reporting Module?

texts:
My project involves multiple users selling products on the site. I am liking the simple displays of the Commerce Reporting module and I am wondering if it can be set up per user.

  For example :

  User1 when logged in would see sales reports that relate to them (all
  products created by that user).

  User2 when logged in would only see products they created.

What I can see so far is that I have Views options to display Views Blocks of these charts on a specific page. That way i can make duplicate views and add a relationship. This is now where i get stuck. In the relationship options of these specific views there are no "user id" options.

  List of relationship options

  Commerce Order: Owner

  Commerce Order: Payment Transaction

  Commerce Order: Referenced customer profile

  Commerce Order: Referenced customer profile

  Commerce Order: Referenced line items

  Commerce Order: Representative payment transaction

  Commerce Order revision: Order

  Commerce Order revision: User


texts: Ajax %-wildcard URL giving 404 error when setting a parameter

texts:
I have a page with a dropdown. When you click on that dropdown that content is loaded by Ajax. I would like to do the same for the Breadcrumb, so I created an Ajax-URL in my module:

function selectexamfeature_menu() {
  $items = array();
  $items['selectexamfeature/ajax-replace-breadcrumb/%'] = array(
      'title' => 'Ajax-Callback for replacing breadcrumb',
      'page callback' => 'selectexamfeature_ajax_callback',
      'page arguments' => array(2),
      'access arguments' => array('access content'),
      'type' => MENU_CALLBACK,
  );
  return $items;
}

function selectexamfeature_ajax_callback($url){
  $commands = array();
    // later on the $url will be used here for generating the breadcrumb html
  $ret = $url;
  $commands[] = ajax_command_html('.page-breadcrumb', $ret);
  $page = array('#type' => 'ajax', '#commands' => $commands);
  ajax_deliver($page);
}

and in my Javascript code I have:

  var custom_settings = {};
  custom_settings.url = '/selectexamfeature/ajax-replace-breadcrumb/SOMELINKASSTRING';
  custom_settings.keypress = false;
  custom_settings.prevent = false;
  Drupal.ajax['custom_ajax_action'] = new Drupal.ajax(null, $(document.body), custom_settings);

  Drupal.behaviors.selectexamfeature_ajax_replace_breadcrumb = {
    attach: function (context, settings) {
      $( "#edit-field-text-grade-tid" ).change(function() {
        // the event...
      });
    }
  };

So at the end I want to get the SOMELINKASSTRING in my $ret variable. But for now I just get a 404 error all the time:

  An AJAX HTTP error occurred.
  HTTP response code: 404
  Debugg information follows: /selectexamfeature/ajax-replace-breadcrumb/SOMELINKASSTRING Statustext: Not Found...

I believe the issue is in the wildcard section. Somehow it does not replace it correctly.

If I leave the % away and also the SOMELINKASSTRING it works without issues. But I for sure need the parameter to know which page is requested.

Also watch this awesome article but it did not help either.


texts: Cannot move block Main Page Content to different region

texts:
Realy need your help. I'm working with quite old Drupal 7 site and for some reason I cannot move the Main Page Content block to any different region. When I drag&drop it to the Header region (on block management page) and then click save, looks like it sucessfully moved, but when I go to the actual page I can see that it still located in the Content region.

Looks like something is preventing Main Page Content block from moving to different region but I don't know exactly what. I've updated Drupal to the latest release - no difference. I've switched to another theme - no luck.

What might be the problem? I'd be very gratefull for any idea.


texts: How to Implement Modal AJAX Form Pagination

texts:
With the new Drupal8 Modal API I've been able to get a pretty powerful form going.

The form essentially does a POST to an API and displays some search results, which the user can filter. I want to paginate these results.

I'm having a lot of trouble wrapping my head around how this could be done, whether it's with custom ajax requests to increment some kind of counter that is used in the buildForm() function that does the API call, or something else. I've attempted to use Drupal's built in pagination but that doesn't seem like a feasible option as it doesn't even take route parameters.

A full example of the form can be seen at https://github.com/acbramley/embridge/blob/master/src/Form/EmbridgeSearchForm.php

Pagination seems to be broken in core through modals as well, when using a modal window to display (for example) the admin/content screen, pagination doesn't work.


texts: What permissions should I set in Drupal core files?

texts:
I get a very long message when flushing the caches, starting with

  Warning: unlink(/[my-website]/sites/default/files/css/css_mXyk_ET1j0oQS97qAccqHtOxn-21f8f9PeabB5s5OTE.css.gz): Permission denied in Drupal\Core\File\FileSystem->unlink() (line 114 of core/lib/Drupal/Core/File/FileSystem.php).

I never experienced such message with Drupal 7. It doesn't prevent the site to show up, but I wouldn't like to keep a messy installation.
Is it critical? What can I do?


texts: How can I have a single QueueWorker run on cron for multiple Queues?

texts:
I have a site in which I associate multiple Config Entities with a single Queue ie. example_queue (using the default QueueInterface).
My Config Entities produce records that are processed as queue items via that Queue.
Each of these Config Entities have the ability to enable or disable the processing of their records via that queue, so for that I am utilising the SuspendQueueException which I only throw when I know that the items from Config Entity A are disabled for processing.
Because I am using a single Queue, this now also suspends the queue processing for records from Config Entity B which is enabled.
I was thinking of either just getting rid of the SuspendQueueException, but that would then needlessly fail my queue items for Config Entity A, which I already know are failing, OR I would have a Queue per Config Entity. But then I would need to define a QueueWorker class per Queue, I think? Which could become a problem if I have let's say 1,000 Config Entities, each needing such an individual QueueWorker class?
How should I address this best? Or how can I have 1 QueueWorker utilise multiple Queues that I know need the same processing logic?
This is my ExampleQueueWorker class:
namespace Drupal\example\Plugin\QueueWorker;

use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Queue\QueueWorkerBase;
use Drupal\Core\Queue\SuspendQueueException;

/**
 * Process a queue of items.
 *
 * @QueueWorker(
 *   id = "example_queue",
 *   title = @Translation("Example Queue worker"),
 *   cron = {"time" = 60}
 * )
 */
class ExampleQueueWorker extends QueueWorkerBase implements ContainerFactoryPluginInterface {

  /**
   * The maximum amount of times a single queue item is allowed for retries.
   */
  public const MAX_RETRY_THRESHOLD = 5;

  ...

  /**
   * {@inheritdoc}
   */
  public function processItem($data) {

    // $obj can have a parent of Config Entity A, B, C, etc...
    if (!$obj = \ExampleRecord::load($data->getId())) {
      $this->logger->error('Invalid item.');
      return;
    }

    try {
      // Process or halt depending on $obj parent settings.
      $this->ExampleService->post($obj, TRUE);
    }
    catch (\Exception $e) {
      // Log failure.
      $this->logger->error('ID: %id, Error: %error', [
        '%id' => $obj->id(),
        '%error' => $e->getMessage(),
      ]);

      // Get retry count.
      $retry_count = (int) $obj->getRetryCount ?: 0;

      // Increment and save retry count.
      $obj->setRetryCount(++$retry_count)->save();

      if ($retry_count >= self::MAX_RETRY_THRESHOLD) {
        return;
      }

      // Treat a ServiceOutageException as a reason to suspend the queue.
      if ($e instanceof \ServiceOutageException) {
        throw new SuspendQueueException($e->getMessage());
      }

      // And any other Exception for default queue error handling.
      throw new \Exception($e->getMessage());
    }

  }

}


texts: Unable to delete feature content type after uninstalling feature

texts:
Issue
Uninstalling a feature which creates a content type hides the "Delete" link on the admin/structure/types.
Issue on Drupal.org


texts:
I'm completely lost on how I could display an image uploaded by user on my webform...

What I'm planning to do is multistep webform that is also an order form. It has only filefield upload on first page, on the second page, that uploaded image should be presented/shown in a grid with few different image styles and static description to tell which is which so users can select those which they like. Only this feature is hitting me back and refusing to work so I could finish this project.

Any and all advices greatly appreciated.


texts:
I have planned to use Composer to manage Drupal core and third-party modules instead of pushing everything to Git and I am using drupal-composer/drupal-project to achieve it.

After running composer create-project drupal-composer/drupal-project:7.x-dev d7 --stability dev --no-interaction, a d7 directory is created with some other directories, including the following ones.

vendor
web (It contains the Drupal core files.)

Its composer.json file is enough to install the same dependencies in another server, but if I use composer install in my server, how can I checkout my custom modules?

If I add custom modules and the composer.json file only in my repository, where do the custom modules go when I run during composer install? Do they go in sites/all/custom or the root directory?

Is there any other option available to manage my custom modules with Composer?


texts: Alphabetical view sorting in multilingual site not working for translated content

texts:
I have created a view that alphabetically lists all nodes of type "glossary entry". A glossary with many terms. Besides German I need the glossary in English, too. The translation has worked great using Entity Translation module. I only have the problem that the alphabetical order of the English version is not correct. The English glossary has the same sort order than the German (original) version:

  German version:

  Adler (German word for eagle)
  Hund (German word for dog)
  Kuh (German word for cow)

  English version:

  Eagle
  Dog
  Cow

I crawled many forums but couldn't find a solution for my problem. I already added the relationship "Entity Translation" in my view but the additional filter and sorts don't help me here.

What I need is a sort "title (English Translation)". Does somebody has a clue how to get this work?!!

Please find here the view's query


texts: I had a reservations system with the .bat module.  But I want to change the timeformat in my timelineview from am/pm to 24hours time notation. I have been looking in batfullcalander and the library of fullcalendar and fullcalanderscheduler. Can someone help me out with this?


texts: How do I change the "Access Denied" message?

texts:
I have a need to temporarily unpublish some pages on our website, but when anonymous users try to access an unpublished page, say they had it bookmarked, they get the message:

Access Denied

Which may sound too harsh. I thought about changing it to 'Page Not Found.'

However, I searched the entire site and I can't find any template that controls this particular message. Using Theme Developer, I can see that the Access Denied page is using the standard page.tpl.php, which I don't believe has anything pertaining to the Access Denied page.  What am I missing?


texts: How do you display a pane in an organic group?

texts:
I'm trying to create a menu of subgroups for organic groups in d7.  I've copied the og list view and made a new view called og subgroups.  I made a pane display and configured the pane's argument to be Og group ID from context.  I also added the contextual filter: (group) OG group: Og group ID and the relationship: Group: Node group.

When I enter a group ID in the preview field of the view, it loads the appropriate menu items. When I go to the Group variant for the node template in panels, and add the pane as content in the appropriate region panels shows that the argument is group ID, but if I view the group it does not display the pane.

Am I doing something wrong?


texts:
Is there a way to clone or make copies of blocks?

For example, we have some blocks that are quite bespoke. We need to make multiple copies of them so we can display certain content within them on different pages.


texts: How can I get the date_popup module to display AM/PM in the time selector?

texts:
In date_popup's README.txt, it states that

  The time selector will add AM/PM if 'a' is in the format string.

Which leads me to believe that

'#default_value' => date("m/d/Y H:ia"),
'#date_format' => 'm/d/Y H:ia',

should result in a textfield for the time picker that looks like:

  [2:25pm]

but instead I just get a blank text field. I can't get any combination of default_value / date_format to result in what I'm looking for. Am I reading the documentation wrong, or can this be achieved?

Update: I couldn't get this darn thing working and decided to disable the timepicker (admin/config/date/date_popup) and added the timepicker from http://jonthornton.github.com/jquery-timepicker/ using the following code:

  $form['#attached']['css'][] = 'path/to/jquery-timepicker/jquery.timepicker.css';
  $form['#attached']['js'][] = '//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js';
  $form['#attached']['js'][] = array('data' => "var jq9 = jQuery.noConflict();", 'type' => 'inline');
  $form['#attached']['js'][] = 'path/to/jquery-timepicker/jquery.timepicker.js';
  $form['#attached']['js'][] = array(
    'data' => "
      jq9(document).ready(function() {
        jq9('#edit-start-date--popup-1').timepicker();
      });",
    'type' => 'inline',
  );
  $form['start_date'] = array(
    '#title' => 'Start Date',
    '#type' => 'date_popup',
    '#required' => TRUE,
    '#date_type' => DATE_DATETIME,
    '#date_timezone' => date_default_timezone(),
    '#default_value' => date("m/d/Y h:ia"),
    '#date_format' => 'm/d/Y h:ia',
    '#date_increment' => 1,
    '#date_year_range' => '-1:+1',
  );


texts: How to display og group visibility in a view, even if user can't change it

texts:
I'm working on a content pane view that displays a list of the groups the current user is a member of. Most properties of the groups are displayed in the view just fine, like the group title. But the group visibility is only shown to specific users.

I'd like to have a note in the group list whether a group is public or private, something along the lines of

  Group #1 | You're a member since... | This group is public

  Group #2 | You're a member since... | This group is private

  (and so forth)

But when I add the field "Content: Group visibility" to the view, the value only is visible for users that have permission to change the respective group's visibility (permission "Administer Organic groups permissions"). For any other user, the "No results behaviour" kicks in. The settings for the field "Group visibility" is public ("author and administrators can edit, everyone can view"), so shouldn't the field's content be visible to everyone?


texts:
I want to add a field on my type of content which allows authors to select a link in a list. If author doesn't find the good link, he can directly add it and name it.

The list has to be composed with the name (title) of all links saved by all the authors of my site. All authors have to be able to add directly a new link in this list.

Any idea ?


texts: How to add 'style="width:100px"' in Global Custom Text field in a view?

texts:
It seems that the Global Custom Text field in a view delete part of my text.

I write this:

Hello

but get this:

Hello

The text removed is this

style="width:100px"

I need to be able to include it.

The value of the 'width' is provided by a token ([field_width]), that's why I need to add it here. It is dynamic value.

Update: I just see that this is a security measure, then how can I make View accept this using a function?


texts: When I visit the registration page, or the login page, it says that I do not have access to that page. Do you have any idea why this happens?


texts:
I currently use search api solr and facetapi to filter jobs on my website.

I now want to create an advanced search on a different page using the same taxonomy as I use with facetapi on my jobpage.

I've tried creating a facetblock but once I click a taxonomy term it directly goes to my job page, I want to be able to select multiple things, press search (much like exposed filters does), and redirect to my job page.

Thanks


texts: How to check if a basic page is published?

texts:
I'm using Drupal 8.1.10. I have a basic page with the URL alias "/enter-competition". On a twig template (not associated with that page), I have the following HTML:

Enter Competition

I need this link to only be included if that basic page is in a published state, like so:

{% if page_is_published %}
Enter Competition
{% endif %}

How can I check if that basic page is published/unpublished?


texts: how to add a remove coupon button to commerce checkout page

texts:
I assumed this would be included in the module, but as far as i can see it isn't. Im using the latest versions of Commerce, Rules, and Commerce Coupon.

I want a "remove" button next to the added coupons in case someone wants to remove it and try another one.


texts: generate multiple custom blocks from a single api call

texts:
I have created a custom module that generates a single custom block based on content retrieved from a remote API. The content is currently displayed in a single contiguous block above the main content.

It works great, however, I am now being asked to split up the custom block content on the page. Essentially, I need to move some of the content into a sidebar and some into a smaller block at the top of the page.

The simple way to do this I guess is to create 2-3 custom blocks through the plugin system and then place them in the desired regions I create on the page templates. The problem with this is that each block would be calling out to the remote api so I would go from a single API call to 3 or even more on the same page. The remote API we are using just returns the entire set of content so I would be loading the same thing 3 or more times.

What I would really like to be able to do is keep my existing block class (in whatever form) and pass that same single API call to 3 seperate templates that can be placed as three separate blocks.

How do I do this?

Alternatively, is is there some way to generate the API call through a function in the .theme file in my theme (abandoning my custom module completely) and then just pass the variables directly to the page rather than going through the block system? I could also live with that though i am not sure how to do it.


texts: CKEditor simple image upload functionality

texts:
I'd like to have a simple, one-click, image upload functionality with CKEditor. I'm using D6 and CKEditor 3.6.1. I do not want a server file browsing functionality, only uploading images from the user's own computer.

I've done a thorough search on this subject and have tried different suggested approaches. It seems like the solution that best suits my needs is installing the IMCE module and the CKFinder plugin for the CKEditor module. So I did just that, and followed the installation instructions found here: http://drupal.org/node/738092

The uploaded image manages to get to the destination folder on my server, but when I open CKEditor's 'Image properties' dialog and hit the 'Send to the server' button, nothing changes on the UI.

What I wish to happen is for CKEditor to close the 'Image' dialog and insert the uploaded image into the textarea.

Here are some screenshots to better explain my situation:

- Uploading a file from my desktop

- Expected result - 'Image' dialog automatically closed and image inserted to textarea

- Actual result - 'Image' dialog stays open and nothing changes

Does anyone ever implemented an image upload functionality this way? Is there a better way to get what I want?


texts: Different style when listing nodes and displaying a single node

texts:
I'm new at Drupal, coming from the PHP framework world, and I'm having some problems understanding the the template hierarchy in Drupal 7.

I've created a template called 'node--article.tpl.php' and can style my single article nodes. The problem is that this affects the front page as well. I want to style the node list different then when displaying single nodes. How can I do this?


texts: How to create a composite filter that allows multiple selections?

texts:
I am using composite views filters in my exposed filters.

I have defined my groups in the composite filter as follows:

ab = a OR b
cd = c OR d
ef = e OR f

However, I only seem to be able to display the options as a dropdown list, with only one selection possible. I'd like users to be able to select both ab and cd together by ticking checkboxes (in other words "ab OR cd").

I've tried doing this using Better Exposed Filters but it doesn't give me any relevant options for the composite filter. (Other filters can be displayed as checkboxes for example)

Any ideas how I can get multiple selection to work?


texts: Joining 2 uids in custom table with users table

texts:
I have a custom table. Inside that table I have 2 uids.

Using hook_views_data_alter I know how to make a join with users table. My field is called also "uid".

The join looks like this:

    $data['ofertas_producto']['table']['join'] = array(
        'users' => array(
            'left_field' => 'uid',
            'field' => 'uid',
        ),
    );

    $data['ofertas_producto']['uid']['relationship'] = array(
        'base' => 'users',
        'field' => 'uid',
        'handler' => 'views_handler_relationship',
        'label' => 'Creador del Producto',
    );

As you can see the join defined in the first array has only one possible definition with the users table and one left field inside of it. So if I want to define another join with a second field "uid_2" it will override the first declared join.

Am I right? Thanks for your knowledge.


texts: Is there a module that creates a taxonomy of the world's languages?

texts:
Before I go creating my own taxonomy with the worlds languages as terms, I just wanted to see if there was a module out there that is already handling this?

EDIT:

I did lots of searching for a module before posting here but just wanted to make sure I didn't miss anything before going my own way.


texts:
Whats the best way to add a Text Resize feature in the theme instead of using contrib modules.

I have tried Text Resize but it dosn't work for my custom theme. I told it to resize in entire "body" of my page but it ends up resizing only one paragraph.

are there other themes who have done this?


texts: Pass nid variable to Ubercart order in D7

texts:
How can I pass a node's nid variable to Ubercart so that when the user pays for publishing his node, the nid shows in the cart?

I tried to add a field to the Ubercart Order fields, with widget node reference which is passed by the URL. When my user clicks on "Pay for node" link, it sends him to the Ubercart "node" product page "pay?23" 23 being the node they are paying for. When the user presses Add to Cart, I cannot see this value 23 in any of the user's order or checkout details. How can I get this value attached to the order?

I've googled for a while now and cannot find anything about this for D7. Any help will be much appreciated!


texts: Run PHP when node and/or profile is updated?

texts:
I wanted to run an external script when a user profile(2) is updated, and/or when a node is updated. I've added the code to the themes template.php, but no go.

What have I missed?

<?php

$api_script_url = "http://www.aaa.com/test/test.php";
$msg = "File updated.";

// WHen a node is updated, be it new or old, update file.
function theme_node_update($node) {
    include($api_script_url."?q=".$node->nid);
    drupal_set_message($msg, 'status');
}

// WHen user profile2 profile is updated, be it new or old, file.
function theme_profile2_update($profile) {
    include($api_script_url."?q=".$profile->uid);
    drupal_set_message($msg, 'status');
}

?>


texts:
I currently have a content type called book, where the book has fields: author name, book title, ISBN , publication date, ect.

I'd like to automatically generate a bibliography entry for each book so that users can copy and paste it easily. Is there a module that can do this? I know of the biblio module, but to the best of my knowledge you must directly input the information.

So is there a way to automatically generate a bibliography citation entry for a given book based off of the book's given fields?


texts: unable to search SOLR index for pdf content

texts:
I setup SOLR in order to index pdf content. I followed this article: https://www.chapterthree.com/blog/indexing-pdfs-for-solr-search
I'm able to index pdf content using SOLR extractor instead of Tika. I can query solr using the SOLR web interface, and a query like 'tm_X3b_fr_saa_field_media_document:(+"breyer")^1' returns appropriate results.
I created a page views, based on SOLR index. I added a full text search in the filter criteria, and added the field holding pdf content to the list of searched fields. If I search for a term that exists in a field other than the pdf content, it works. If I search for a term that only exists in the pdf content, I get no result.
I have no idea why SOLR doesn't return the results. If I look at the query displayed in the box provided by the search API Solr devel module, I see that the query is formulated this way:
q=(tm_X3b_nl_body:(+"breyer,")^1+tm_X3b_fr_body:(+"breyer,")^1+tm_X3b_en_body:(+"breyer,")^1+tm_X3b_und_body:(+"breyer,")^1+tm_X3b_zxx_body:(+"breyer,")^1+tm_X3b_nl_field_long_description:(+"breyer,")^1+tm_X3b_fr_field_long_description:(+"breyer,")^1+tm_X3b_en_field_long_description:(+"breyer,")^1+tm_X3b_und_field_long_description:(+"breyer,")^1+tm_X3b_zxx_field_long_description:(+"breyer,")^1+tm_X3b_nl_field_short_description:(+"breyer,")^1+tm_X3b_fr_field_short_description:(+"breyer,")^1+tm_X3b_en_field_short_description:(+"breyer,")^1+tm_X3b_und_field_short_description:(+"breyer,")^1+tm_X3b_zxx_field_short_description:(+"breyer,")^1+tm_X3b_nl_saa_field_media_document:(+"breyer,")^1+tm_X3b_fr_saa_field_media_document:(+"breyer,")^1+tm_X3b_en_saa_field_media_document:(+"breyer,")^1+tm_X3b_und_saa_field_media_document:(+"breyer,")^1+tm_X3b_zxx_saa_field_media_document:(+"breyer,")^1+tm_X3b_nl_saa_saa_file_entity:(+"breyer,")^1+tm_X3b_fr_saa_saa_file_entity:(+"breyer,")^1+tm_X3b_en_saa_saa_file_entity:(+"breyer,")^1+tm_X3b_und_saa_saa_file_entity:(+"breyer,")^1+tm_X3b_zxx_saa_saa_file_entity:(+"breyer,")^1)
How does SOLR interpret the + sign between the fields ? Normally it should be a blank or "OR", no? Because if I use this query by substituing + by a blank character it works.
Any idea?


texts: Memcache and form cache - is specfiying database for form cache still necessary?

texts:
In Drupal 7, a typical setup for Memcache API and Integration was to add this into your settings.php:

  $conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
  $conf['lock_inc'] = 'sites/all/modules/memcache/memcache-lock.inc';
  $conf['memcache_stampede_protection'] = TRUE;
  $conf['cache_default_class'] = 'MemCacheDrupal';

  // The 'cache_form' bin must be assigned to non-volatile storage.
  $conf['cache_class_cache_form'] = 'DrupalDatabaseCache';

  // Don't bootstrap the database when serving pages from the cache.
  $conf['page_cache_without_database'] = TRUE;
  $conf['page_cache_invoke_hooks'] = FALSE;

Note the importance of the form cache being told to still use the database.

For Drupal 8, the README says you only add:

  $settings['cache']['default'] = 'cache.backend.memcache';

Is there any need to leverage the database for forms in Drupal 8? What line would you add?


texts: How to make title exact match appear first in search API

texts:
For example,
I have content A with :

title = Quick brown fox jumps
body = (empty)

and then I have many other content with word 'quick', 'brown', 'fox', and 'jumps' all accross the body field.
I use govCms distribution profile.
What happen
When I search for content with title "Quick brown fox jumps", content A is displayed on rank 4th on 1st page.
What I expect
It should be rank 1st because it has exact match.
Module I use:
Search API, Search API page, Search API Database Search
What I try

I try to set Influence for Content is promoted to front page to 10, and make content A as promoted to front page. Clear index and build search index, but still no change.

I try to boost Title field (Type: Fulltext, Indexed: Checked) to 21.0, clear index and build search index, but also no change.

Question
How to make content with exact title to appear 1st?


texts: How can I specify a "Text Field" as an "Attribute Field Setting" for a Product Variation in Drupal Commerce?

texts:
I am working with a client that handles distribution for an array of goods that do not fall into traditional sizing schemes (S, M, L). Instead, some products are characterized by length in mm, weight in kg, qty in a kit, etc. Because of the wide array and volume of nodes, it doesn't make sense to create a new vocabulary/category out of so many unrelated terms.

Set 1: 160mm, 180mm, 203mm
Set 2: 1xsm + 2xlg; 2xsm
Set 3: 25 mL, 250 mL, 1 L, 5 L
etc (totally different kinds of sets that are not reused across product types)

I specified a "text field" as "Product specific size", allowing the user to insert whatever size type made sense up to 100 characters. I thought I could use that as a dropdown menu so that the size could be selected by the shopper in the "Add to Cart" form.

However, it looks like that's a no-go for text fields. Because the size varies across other parameters (qty in kit x color), having the variant name be the selection method seems pretty hokey.

What have others done for this use case?

Thanks - keb


texts: As an admin, how can I view individual user permissions for individual nodes?

texts:
I’m attempting to sell individual nodes (video classes) to individual customers on my client’s website. I've learned how to do this via two videos from Commerce Guys website. It uses the following modules:

Content_Access, ACL, References, Rules, Commerce

Briefly it works like this:
Two content types are created - a video class product, a video class. Each video class product has  a reference to a video class. Once purchased an individual then has permission granted to view the video class, the one ref’d by the video class product. By default video class content type permissions are turned off. But on the access control tab of the content type there is an option that is checked that reads ‘Enable per content node access control settings’

My question is this: As an admin how can i view an individual user’s permission setting for individual nodes? and then change that permission?

I’m asking because although it works initially, at some point the user’s permissions are being being reset, ie turned off and I’m not sure why.

Any help would be greatly appreciated.


texts: I have 3 pages in my website where user can either register register of login. On each page the amount of data required for registration is different. Problem is that i need to use webforms for the user registration pages and create 3 different forms with different level of data being asked. And when the user enters his email ID in the registration form, if he has already submitted the form once, his previous data should be filled up in the user registration for editing purpose.


texts: Translation of months and days in Calendar Views Module

texts:
The Views Calendar template displays months and days, i.e. June, July, Monday, Tuesday,  etc.

When someone changes from english to french, how can I tell it to display the months in a different language?


texts: I can´t publish the title of my contact form

texts:
I´m  starting to build a site using my own theme, the problem is that I can´t see the title of my contact I start to build my own theme, the problem is that I can´t see the title of my form contact or the title of any views that I was used. Just when change my theme for bartik the title appear.
the site was implemented with Drupal8
my site: www.anep.edu.uy/observatorio2
Thanks in advance


texts:
I need to fetch the database records for particular date using database query , i tried some queries to fetch but it showing all records in table .

controller.php

public static function load($entry = array()){
$maxDate = \Drupal::request()->query->get('set_start_date');
$minDate = \Drupal::request()->query->get('set_end_date');
 $select = db_select('pastpayments', 'x');
 $select->fields('x');
 foreach ($entry as $field => $value) {
 $select->condition('paiddate', $maxDate, "<=");
 $select->condition('paiddate', $minDate, ">=");
}
 return $select->execute()->fetchAll();
}

public function entryList() {
$content = array();

$content['message'] = array(
  '#markup' => $this->t('Generate a list of all entries in the database. There is no filter in the query.'),
);

$rows = array();
$headers = array(t('Member Id'), t('Name'), t('Paid Date'), t('Paid Date'));

foreach ($entries = $this->load() as $entry) {
  // Sanitize each entry.
  $rows[] = array_map('Drupal\Component\Utility\SafeMarkup::checkPlain', (array) $entry);
}
$content['table'] = array(
  '#type' => 'table',
  '#header' => $headers,
  '#rows' => $rows,
  '#empty' => t('No entries available.'),
);
// Don't cache this page.
$content['#cache']['max-age'] = 0;

return $content;

}

  how  i can fetch the table records for particular date ranges

database query

mysql> select * from pastpayments where paiddate >='2017/03/01' and paiddate <='2017/03/30';


texts: Error reindexing attachments in Drupal 7 using Apache Solr Attachments module

texts:
I've installed Solr 3.4.0 and Tika .10 on my Windows 2003/IIS6 server.  I have loaded the Apache Solr Attachments module and configured so I can search on documents attached to pages in my Drupal 7 web site.  When I reindex on the Apache Solr search configuration page I'm getting 5 of these notices:

Notice: Undefined index: filepath in apachesolr_attachments_add_documents() (line 133 of W:\www\drupal-7.8\sites\all\modules\apachesolr_attachments\apachesolr_attachments.index.inc).

The search index page indicates the attachments have been submitted for reindexing (message on the page -> "There are 0 items remaining to be examined for attachments out of 23 total.  The search index is generated by running cron. 100% of the site content has been sent to the server. There are 0 items left to send. " and "Number of documents in index: 23 (0 sent but not yet processed)").  On the Search settings page I see "100% of the site has been indexed. There are 0 items left to index." under Indexing Status.

Search is working for web site content but search for content in attachments is not working.    If I got into Solr admin and query I can see web site content but searches for words in attachments return no results.  So the attachments are not getting into Solr.  Any ideas about what this error means or how I can debug it?


texts: Is there a module that shows when you last updated or modified an installed module?

texts: From time to time I update my modules and I would like to see when they were last updated. Is there such a module that adds this information?


texts:
I have this doubt.
I have a website in drupal 7 currently live (Kickstart2) and use as cache management boost
I have to buy a ssl certificate on my domain and with this certificate I would like to cover only the path checkout/* and user/*

I would like to proceed in this steps:

buy ssl certificate for the main domain
install the module securepages
configure the module with the path checkout / * and user / *

by this configuration I expect something like that:
http://www.example.com/mypage but https://www.example.com/checkout
only /checkout will be in https. Is it right?

This is just as reasoning and how to configure the module? Is it the right way?

Last question:
I read that boost module does not work well with ssl, that it means that my checkout/* pages will not be under cache, but the rest of the pages? Rest of the path like /about or /news are all done under cache?
You can confirm this to me?

Ty guys


texts: Email sent to customer from Drupal has RED LOCK icon in the email

texts:
I'm using Drupal Commerce. Overall it's working well. I have SSL setup and enforced so users HAVE to use 'https' (via .htaccess). I'm able to test fill out the form and it submits. PayPal gets the payment. We're happy. I get an email telling me a new purchase has been made (via Drupal at site:mail token).

The issue is, the user also receives an email from Drupal letting them know, you know, thanks for purchasing, etc. However, in the email to the person who purchased the product (in gmail specifically as that's all I've tested with) there is a RED LOCK icon next to their name/email at the top of the email. When hovered over it says 'bluehost.com did not encrypt this message'.

Now, MAYBE it doesn't really matter because i'm not sending them their credit card info back to them or anything, but it does LOOK disconcerting and I'd like it not to be there in their email. So I need their email to be encrypted.

I talked to Bluehost and they said it was an internal linking issue. The only link in the form is their email address that they put in (it's a custom field we setup).

Does anyone know how to encrypt their email address in the form before Drupal sends it to them? Or tokenize it properly perhaps is another approach since site:mail doesn't have that issue.

Here's the token I'm using to send them the email from Drupal:

[commerce-order:commerce-customer-billing:field-email-address]

Note: I'm using 'Send mail with Variable' action to send this email, if that's worth noting.


texts: Is it possible to set Cookie Session ID from a REST Service?

texts:
I have overridden Drupal's login process by calling a REST API which returns a 'true' or a 'false' depending on whether the login was successful or not. Once successful, I'm logging the user in by using a particular Drupal user account.

Would it be possible to change Drupal's Session ID to the one specified by the REST API call? Currently the REST API Call is giving me a JSESSIONID cookie and I was wondering if its possible to map this cookie to the one Drupal generates when the user logs in. Reason I need this is because I need keep track of this JSESSIONID to call other API methods related to the logged in user.


texts: How to define frontend theme (non-admin) for a given node tab route?

texts:
In my custom module I want to define a new tab associated with nodes. I have my own custom route file with the required definitions and a Links file to make sure the new route will be displayed as a node tab.

Everything works as planned, except that... The content of my custom page is wrapped in admin theme, not the website frontend theme.

I have found other threads where people ask the opposite question: 'how to enforce admin theme'? In those situations, it looks like that by setting '_admin_route: TRUE' on the route file will do the trick. More on this here:

How to set admin theme for a route?

I thought I would be able to achieve what I want by setting '_admin_route: FALSE', but it doesn't work. Frontend theme doesn't show, admin theme still kicks in.

This is my modulename.route.yml file:

modulename.node.custom_tab:
  path: '/node/{node}/custom-tab'
  defaults:
    _title: 'Custom tab Content'
    _controller: '\Drupal\bti\Controller\MyTabController::pageContent'
  options:
    _node_operation_route: TRUE
    _admin_route: FALSE
    parameters:
      node:
        type: entity:node
  requirements:
    _permission: 'access content'
    _custom_access: '\Drupal\bti\Controller\MyTabController::access'

And this is my modulename.links.task.yml file:

entity.node.custom_tab:
  route_name: modulename.node.custom_tab
  base_route: entity.node.canonical
  title: 'Custom tab'
  weight: 50
  options:
    attributes:
      class:
        - 'my-custom-class'

So, to sum up: how can I make the new custom page in a node tab be displayed with theme defined for the frontend, not the admin theme? Thank you!

Edit 1

Is it possible that what I am looking for is the attribute '_theme' inside 'options'? It is marked as TODO here: https://www.drupal.org/docs/8/api/routing-system/structure-of-routes.


texts: Drupal Taxonomy View as main site navigation

texts:
I have searched and tried everything to try and get this working but am still stuck.

I am writing a classified ads site for my local ice rink and can't fo the life of me get the taxonomy structure working. Drupal 7.41

I have a taxonomy structured like this but bigger
Taxonomy vocabulary name-Skate Catagory
Structure

Figure Skating

skates

skate type 1
skate type 2

bag

bag type

Clothing

ice Hockey

skates

skate type 1
skate type 2

bag

bag type

You get the idea.

I would like a veiw to be the main page that displays the top level terms with an image for each.

When the user clicks the image it drills down to layer 2, so user clicks figure skating and the page changes to show all teasers of figure skating

To drill down further i think quick tabs may be used

Any advice welcome, is this the best way to deal with a 3 level search?


texts: Varnish doesn't cache first hit at all, only second hit

texts:
I have Varnish 4 with Drupal 7. In Drupal settings.php I have:

// Tell Drupal it's behind a proxy.
$conf['reverse_proxy'] = TRUE;

// Tell Drupal what addresses the proxy server(s) use.
$conf['reverse_proxy_addresses'] = array('127.0.0.1');

// Bypass Drupal bootstrap for anonymous users so that
// Drupal sets max-age &lt; 0.
$conf['page_cache_invoke_hooks'] = FALSE;

// Make sure that page cache is enabled.
$conf['cache'] = 1;
$conf['cache_lifetime'] = 0;
// Set page cache max-age to 600 secs (10 min)
// Change this to the highest time possible for your needs
// Drupal will set a Cache-Control: "max-age=600" header
$conf['page_cache_maximum_age'] = 21600;

$conf['cache_backends'] = array('sites/all/modules/varnish/varnish.cache.inc');

$conf['cache_class_cache_page'] = 'VarnishCache';

In the varnish vcl file I have:

vcl 4.0;

# Default backend definition. Set this to point to your content server.
backend default {
    .host = "127.0.0.1";
    .port = "8080";
}

sub vcl_recv {
    # Happens before we check if we have this in cache already.
    #
    # Typically you clean up the request here, removing cookies you don't need,
    # rewriting the request, etc.

 ## ADMIN PAGES ##

    # Here we filter out all URLs containing Drupal administrative sections
    if (req.url ~ "^/status\.php$" ||
        req.url ~ "^/update\.php$" ||
        req.url ~ "^/admin$" ||
        req.url ~ "^/admin/.*$" ||
        req.url ~ "^/user$" ||
        req.url ~ "^/user/.*$" ||
        req.url ~ "^/flag/.*$" ||
        req.url ~ "^.*/ajax/.*$" ||
        req.url ~ "^.*/ahah/.*$") {
           return (pass);
    }
}
sub vcl_backend_response {
    # Happens after we have read the response headers from the backend.
    #
    # Here you clean the response headers, removing silly Set-Cookie headers
    # and other mistakes your backend does.
if (bereq.url ~ "(?i)\.(css|js|jpg|jpeg|gif|png|ico)(\?.*)?$") {
        unset beresp.http.set-cookie;
    }
# Set cached objects to expire after 1 hour instead of the default 120 seconds.
    set beresp.ttl = 4h;
}

sub vcl_deliver {
    # Happens when we have all the pieces we need, and are about to send the
    # response to the client.
    #
    # You can do accounting or modifying the final object here.
if (obj.hits > 0) {
               set resp.http.X-Cache = "HIT";
        } else {
               set resp.http.X-Cache = "MISS";
        }
}

This is my header at isvarnishworking:

HTTP/1.1 200 OK
Date:   Fri, 02 Mar 2018 13:51:24 GMT
Content-Type:   text/html; charset=utf-8
Connection: keep-alive
Set-Cookie: __cfduid=dfac4e840061f192552b77dfd3430fcfc1519998683; expires=Sat, 02-Mar-19 13:51:23 GMT; path=/; domain=.mydomain.net; HttpOnly
X-Powered-By:   PHP/5.4.45
X-Drupal-Cache: MISS
Expires:    Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control:  max-age=64800, public
X-Content-Type-Options: nosniff
Content-Language:   en
X-Frame-Options:    SAMEORIGIN
X-Generator:    Drupal 7 (http://drupal.org)
Vary:   Accept-Encoding,User-Agent
X-Varnish:  459087
Age:    0
Via:    1.1 varnish-v4
X-Cache:    MISS
Server: cloudflare
CF-RAY: 3f54567d343346ec-EWR
Content-Encoding:   gzip

I'm using Cloudflare, but I've already been try to shutdown Cloudflare for 2-3 days. Still, Varnish doesn't hit the first time, only the second time.


texts: How to execute javascript iframe in custom module?

texts:
I have created a custom module for Drupal 7. In this module, I would like it execute a javascript file that embeds an iframe when the module is viewed. I have tried the following code with no success:

function chat_with_librarian_block_view($delta = '') {

  $block = array();
  switch ($delta) {
    case 'chat_with_librarian':
      $block['subject'] = t('Ask a Librarian');
      $block['content'] = chat_with_librarian_get_html();
      break;
  }
  return $block;
}

function chat_with_librarian_get_html() {

  $html = '
' .
    '
' .
    '';
  $form = array(
    'chat_frame' => array(
      '#type' => 'markup',
      '#markup' => $html,
      '#prefix' => '
',
      '#suffix' => '
',
    )
  );
  return $form;
}

What do I need to do to get the embedded javascript to work properly. As a side note I can make this work by creating a block through the administration screen, so I know this can be done. I just need to know what I am missing in my code to accomplish the same thing. When I do execute this code, the title is rendered but the body isn't. Examining the body of the block, I can see it contains the javascipt as returned by the function and an additional message:

Reload the page to get source for: url

It seems like the executing code cannot get correct div dimensions to return a proper iframe (but that is just a guess on my part - have put inline css to define a size). Has anyone come across something like this or how to get this working?

Thanks.


texts:
Drupal 7 Views 3

Setting up a list of schools and their referenced courses in one table generated through views. Every school has multiple courses, therefore getting multiple rows for each school by default.

Getting:

+-------+-------+
|Schools|Courses|
|-------|-------|
|school1|courseA|
|school1|courseB|
|school1|courseC|
|school2|courseA|
|school2|courseB|
+-------v-------+

Wanting:

+-------+-----------------------+
|Schools|Courses                |
|-------|-----------------------|
|School1|courseA,courseB,courseC|
|School2|courseA,courseB        |
+-------v-----------------------+

Additional requirement:
The course field is rewritten by views for it to show some additional info about a course from other fields when hovering over it.

What I already tried:

Views merge rows module
does exactly what I need in terms of displaying results - was happy for a moment until I realized it messes up views pagination because it only changes the display of the query. Created an issue here. Edit: I wrote a patch to address this issue; ended up using this solution (see accepted answer for link).
Views Aggregation with concat function patch aggregates schools and correctly summarizes course names next to each school, however in each row the course names merge into a single field(?) so when hovering mouse over a course, instead of getting additional info for this course, getting it for all courses in this row. Note I am new to aggregation and probably use rewriting incorrectly in combination with it.

It's probably something one can do without any modules out of the box but it escapes me. Therefore please give any advise even if it appears obvious.

Thanks a lot!


texts:
Does anybody have an idea, how to do a facebook url or link fetcher just link the one on facebook.

I have tried and have got a script but how to convert that into a drupal module for it to work.

Let me try to be more clear.

If you type a link on facebook it will go and get the image, meta description and other info from that link.

This is what i want to achieve.

If a user enters a link, what or how can i pull the data like image, meta description, etc etc from the link provided by the user.

Facebook-style link module is the perfect example of what i need but it is only for drupal 6 and i need it for drupal 7.


texts:
I am in learning phase of Drupal and ofcourse the Entity API. I have created new entity named Projects. Goal is to make a project management system for software services providers. I am actually trying to figuring out the mechanism for workflow. I have a entity now. How would i let the user with role Manager add a new project and a user with role Developer can add updates to it like status, files attachment etc.

I need a basic overview so that i can use Drupal to build application rather than a content based website.

Thanks alot


texts:
In my installation (Drupal 8 with paragraphs) firing multiple ajaxcalls by clicking the "edit"-button on paragraphs or "add paragraph"-buttons before the loading symbol from a previous click disappeared can lead to unexpected behaviour.
This behaviour includes nested paragraphs being unpublished or the disappearance of all paragraphs. The behaviour is not consistant. These faulty forms can sometimes still be saved, i.e. a paragraph and all it´s children are suddenly unpublished.
This could be solved by making the buttons unclickable while anything is loading. However, imho this is not a desirable solution since it only circumvents the problem and doesn´t provide a clean workflow anymore and can probably lead to other errors.
Has anybody else encountered this problem or has a good idea on how to solve this?


texts: Different checkout form based on different membership

texts:
I have four types of membership.

1) non school Organizational Membership.

2) Individual Membership.

3) School Membership

4) Free Membership.

So based on these membership i want to open different checkout form.

Currently i used ubercart module and it open the same checkout page for all members.

Here are some attached screenshot, so i want the same functionality like attached screenshot.

1) membership page.

2) Join us page:-

3) Checkout page (four kind of checkout form based on membership).

a) non school Organizational Membership checkout page:-

b) Individual Membership checkout page:-

c) school Membership checkout page:-

d) Free Membership checkout page:-

Can anybody tell me what kind of module i need to use to achieve this kind of functionality, or if i need to do customization then please provide me some idea about that.

Thanks.


texts: The way to join the entity to itself and use joined fields in UI

texts:
I have a list of locations and want to make a view of routes between them.
In classical sql the query will be:

SELECT src.name, dst.name FROM locations src LEFT JOIN locations вые ON src.name!=dst.name

I made hook_views_pre_execute:

function bd_create_views_pre_execute(\Drupal\views\ViewExecutable $view) {
  if ($view->id() == 'ways' && $view->current_display == 'list') {
    $input = $view->exposed_raw_input;
    $query = $view->build_info['query'];
    $query->leftJoin('taxonomy_term_field_data', 'joj', 'taxonomy_term_field_data.tid != joj.tid');
    $query->addField('joj', 'name', 'label1');
    $view->build_info['query'] = $query;
    $view->build_info['count_query'] = $query;
  }
}

What is the way to bring label1 to views admin interface?

Or is there another way to join using only admin interface?


texts: How can I generate a list of PDF Forms based on user input?

texts:
I am looking to make a user-friendly "form" for the HR department but am not sure how to do it.

My goal is to display a list of PDF forms based on the type of employee is being hired.

The HR user would be asked to select option that pertain to the type of worker that is being hired (hourly/salary, type of employee, etc.)

Based on what is answered, certain forms will be given to the user to download.

How can I accomplish this task?


texts: Unable to specify different grid columns settings for page and attachment

texts:
I am trying to build a views grid display where I have two rows of 3 items each, and then one row of of four items. To me, the logical approach would be to use a primary display in a grid format, and then an attachment, since the layout is slightly different. However, this does not work, because it is impossible to have different grid settings for the primary display and the attachment.
For instance, I set the number of columns to 3 for the page display. However, when I create the attachment display, set the columns to 4, and attach it to the page display, when I go back to the page display, the columns in the grid settings is set to 4. In order to get 4 items in a row in the attachment without affecting the parent display, I have to use the unformatted format and do theming.
Is there a way to have separate grid settings for an attachment vs the parent display? There is no option in the grid settings for overriding for just that display.


texts:
I have a block, created with a custom block plugin (extending BlockBase),  that shows on every page, and I want to cache its data, to speed up  performance.

I have added cache tags to the build() function:

$build['#cache']['tags'] = $cache_tags;

But the build() function is still executing on each page load.  I guess because the cache tags are for render cache, not data cache.

Is there a built in way to cache the data in the build() function for a block for logged in users?

Or do I have to add custom caching in the build function, like this:

if ($cache = \Drupal::cache()->get($cid)) {

https://api.drupal.org/api/drupal/core!core.api.php/group/cache/8.2.x


texts: How can I pass a custom variable to a template?

texts:
I have tried to set the value of variables in several hooks, but although these hooks are called, the value is not passed to the views template file.

Does anyone know where to define a custom variable to be used in the views template?


texts: I cannot see the dblog of my kickstart commerce

texts:
When I navigate to /admin/reports/dblog, nothing happens. It only shows me a node, and if I go to the Admin menu then I cannot see the reports link. Check the image below to better illustrate my issue:

My questions: Why I cannot see the reports menu? And how can I access the dblog info?


texts: How to modify the existing field in a form?

texts:
I wanted to modify the existing fields in a form. I tried using hook_form_FORM_ID_alter but I could only add new fields; I could not alter the properties of existing field. I wanted to add ajax properties to some existing fields.

I wanted to alter the content add form which is created by Content Type. I wanted to add an Ajax property to the content creation form. I couldn't figure out a way to add this while creating the content type. Could anyone please help on how to do this? It's very urgent.

This is the DPM for the field.

field_mstyle (Array, 6 elements)

#type (String, 9 characters ) container
#attributes (Array, 1 element)
#weight (String, 2 characters ) -3
#tree (Boolean) TRUE
#language (String, 3 characters ) und
und (Array, 18 elements)
    #entity_type (String, 4 characters ) node
    #bundle (String, 12 characters ) pz_main_menu
    #field_name (String, 12 characters ) field_mstyle
    #language (String, 3 characters ) und
    #field_parents (Array, 0 elements)
    #columns (Array, 1 element)
    #title (String, 10 characters ) Menu Style
    #description (String, 0 characters )
    #required (Boolean) FALSE
    #delta (Integer) 0
    #type (String, 6 characters ) select
    #default_value (Array, 1 element)
    #multiple (Boolean) FALSE
    #options (Array, 4 elements)
    #value_key (String, 5 characters ) value
    #element_validate (Array, 1 element)
    #properties (Array, 4 elements)
    #after_build (Array, 1 element)


texts: Getting the selected option value of a radio button in form_state storage

texts:
I'm trying to make a step form which redirects to a special form depending on a radio button option chosen by the user.

My form always go to the default option value. I think I'm doing it wrong with the $form_state['storage'] getting the selected option.

function multiform_second_form(&$form, &$form_state) {
  $values = $form_state['values'];
  $form_state['rebuild'] = TRUE;

  $options = array(
  '0' => t('Simple'),
  '1' => t('Multiple'),
  '2' => t('Custom'),
);

  $form['qtype'] = array(
  '#type' => 'radios',
  '#title' => t('question'),
  '#options' => $options,
  '#description' => t('Chose a question type.'),
  '#default_value' => $options['0'],
);

  $option_value = $form['qtype']['options'];
  $form_state['storage'] = array(
      'qtype' => $option_value,
    );

  $form['next'] = array(
    '#type' => 'submit',
    '#value' => t('Next step'),
  );

  $form['#submit'][] = 'multiform_second_form_submit';

  return $form;
}

function multiform_second_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  $form_state['rebuild'] = TRUE;

  if (isset($values['next']) && $values['op'] == $values['next']) {

  switch ($form_state['storage']['qtype']) {
    case 0:
    $form_state['storage']['step'] = 'multiform_qsimple_form';
    break;
    case 1:
    $form_state['storage']['step'] = 'multiform_qmultiple_form';
    break;
    case 2:
    $form_state['storage']['step'] = 'multiform_qcustom_form';
    break;
}

  }
}

If somebody can give me some advices, it would be really great !


texts: Fields from different content types in a single page

texts:
Using field permissions i have set 10 fields from various content types (articles, page, etc) to private.

While the rest of the fields is filled by the user, the publisher needs verify and fill those 10 fields to publish the content.

Is it possible to get all these fields in a single page so the publisher don't have to go to the individual content types to fill those fields.


texts: Why table creation on module install doesn't work?

texts:
I need to create custom table for module, but after module install table is not created.

module.install file:

function bip_content_migration_schema() {

    $schema['bip_migrate'] = array(

            'description' => 'Storing content migration info from Joomla.',
            'fields' => array(

                    'id' => array(
                            'description' => 'id',
                            'type' => 'serial',
                    ),
                    'content_type' => array(
                            'description' => 'content type',
                            'type' => 'varchar',
                            'not null' => TRUE,
                            'length' => 255,
                    ),
                    'imported_count' => array(
                            'description' => 'imported count',
                            'type' => 'int',
                            'not null' => TRUE,
                            'default' => 0,
                    ),
                    'to_import_count' => array(
                            'description' => 'to import count',
                            'type' => 'int',
                            'not_null' => TRUE,
                    ),
                    'is_imported' => array(
                            'description' => 'is imported',
                            'type' => 'int',
                            'default' => 0,
                    ),
            ),
            'primary key' => array('id'),
            'indexes' => array(
                    'id' => array('id'),
            ),
    );
    return $schema;

}

What am I doing wrong?

EDIT

I added functions to my .install file (thought that I can ommit theme)

function bip_content_migration_install() {
    drupal_install_schema('bip_content_migration');
}

function bip_content_migration_uninstall() {
    drupal_uninstall_schema('bip_content_migration');
}

But again table is not created.


texts: updating field value of a content type with query

texts:
I have a problem, may you guys can help me :)

I have content type called book, and it has field called stock. Instead of using node_save() I want to update value of book stock using manual query. I have this query, if I run from MySQL client (heidisql ex) the value of book stock has changed already, but if I open the node of book nothing happen. Please help me guys..

node_save() method:

$node = node_load($id); // $id -> node id (nid)
$node->field_stock_value[$node->language][0]['value'] = "whatever";
node_save($node);

my query:

db_query("update field_data_field_stock b left join field_revision_field_stock rb on b.revision_id = rb.revision_id set b.field_stock_value = '{$stock}', rb.field_stock_value = '{$stock}' where b.entity_id = {$nid}");

I want to use query instead node_save() because I want to perform batch set for updating node, and you know, node_save() is really weight.

thank you before, happy new year guys.. :D


texts:
I'm using D7, WebForm Module and Workflow Module.
When the user submit, the state change automatically to the first state.
Users to notify and the submitter user should receive normally the notification.
When i try nothing received!
Can anyone suggest to me, What can i do to prevent this problem from happening?


texts: How to use Context filtering to show images of only other users in a user profile

texts:
I am trying to display linked images of available users within another user profile, without showing the image of the user the profile refers to.

I have used the User ID in a context filter to filter the required linked images and checked Exclude in the More section. This displays the correct images in the preview when a User ID of the profile has been specified.

However, when this is tried on the actual site all the users are displayed, including the user of the profile.

It appears that the filter does not detect the User ID of the profile. Is there a way of correcting the filtering to just show the required users?


texts: Can I take a list of Titles from a Content Type and turn them into a Taxonomy list?

texts: I have a content type called Instructor Profiles. The title field is their name. Can I use a list of this Title field and make a Taxonomy list. Is there a way to keep a list synchronised?


texts:
Ok, I'm at the end of my rope. I tried the "Prepopulate" module, but wasn't much of help.

I have created a content type where user can upload an image in a field: field_rimage in content type StockImages.

When the user views the image, user can choose an image to prepopulate the image field: field_rimage in a new node of another content type Receipe.

As such,User goes to www.example.com/StockImages/ gets a bunch of images clicks on an image... gets redirected to www.example.com/node/add/Receipe
with the image field in Receipe already containing the image selected without having to reuploaded.

I hope I made sense!
Thanks.


texts: Add a button in user orders view requesting info about current order Drupal Commerce 7

texts:
I have an automated e-shop in Drupal 7 and drupal commerce.

I am trying to add an action button in user orders view, which on "pressing" by every current user is sending email(alert with replacement tokens about current selected order) to administrator of eshop.

Any ideas to implement action button?

I tried VBO and Views Send modules but i didn't succeded.


texts: theme_hook_suggestions for string wildcard

texts:
I need to create a copy of page.tpl.php using page--fixed_arg_0__variable_string_arg_1__fixed_arg_2.tpl.php as pattern. For example, if the URL is http://example.com/models/model-title/special-offers, model-title is the variable. I only want one template file instead of 10 or more.

Any suggestions?


texts:
I am constructing a form that is handled via Ajax. I need it to be avaible on browser where javascript isn't activated. For now, the submit part is like :

$form ['submit'] = array (
  '#type' => 'button' ,
  '#ajax' => array (
      'callback' => 'MODULE_form_ajax_callback',
      'wrapper' => 'result-div'
  ),
  '#value' => t ( 'Launch' ),
  '#weight' => 10000
);

Has anyone resolved a similar issue ?

Thanks,


texts: Creating Sign Up form for 2 types users in Drupal 7

texts:
I want to create a single user registration/ sign up form for two types of users e.g buyer and seller. When trying to register, a potential user will have the option of selecting between being a buyer or seller. After completing the form and clicking the sign up button, the user who chooses buyer is immediately logged in while the seller is taken to a page where he needs to provide additional information to complete his/her registration.
I have downloaded and installed profile 2 and auto assign role but am not sure am on the correct path.

Thanks in anticipation.


texts: How can I run PHP code without writing a module?

texts:
I need to attach a field to some bundles. A PHP snippet will do the job for me, so I don't need a module.The below snippet is what must be executed :

$field_name = 'field_custom_image';
// Create the field.
$field = array(
  'field_name' => $field_name,
  'type' => 'image',
);
field_create_field($field);

and then the snippet to add this field to bundle :

// Create the instance.
$instance = array(
  'field_name' => $field_name,
  'entity_type' => 'node',
  'bundle' => 'article',
  'label' => 'Image',
  'description' => 'An image for the article.',
  'required' => TRUE,
);
field_create_instance($instance);

Is there a way to run PHP code directly in Drupal, without the need to write a module, install it, make it run, and uninstall it?


texts:
I'm using Drupal 8 and I have to customize an existing theme.

Should I just make changes in specific files in docroot/themes/theme_name or do I have to create subdirectory somewhere in docroot/sites and there put the files that I wanted to change? I mean make there files with CSS styling that I want to change.

With this theme I cannot create subthemes in Drupal.


texts: Bootstrap CDN over-rides my custom CSS files

texts:
I have a modest site that I was hired to help customize with some CSS features, however I am noticing a problem.

Bootstrap has its own mini-file that tells it what to style its navigation bars with and at the moment, because of that, my nav bar text is grey. Its contrast compared what the site owner wants is very poor and so I attempted to change this to black.

However in doing so, because I am using CDN, bootstrap files seem to override my custom CSS template files. Is there a way to resolve this issue? I have searched for answers but have yet to find any, please help. Thank you.


texts: How to lock distros so they can only be used on 1 URL?

texts:
I plan on making distributions for dating sites and stuff like that.

Maybe sell them as functional themes.

How do I lock the distribution and theme so the client can only use it on 1 URL?

I have seen this done with many website and templates, how can I do this with Drupal?


texts:
In Drupal 7, I am trying to put an image field to allow an image to be uploaded to the theme settings.

I am using managed file from the form API to do this. Here is my code:

  $form['footer']['footer_logo'] = array(
  '#title' => t('Image'),
  '#type' => 'managed_file',
  '#description' => t('The uploaded image will be displayed on this page using the image style choosen below.'),
  '#default_value' => variable_get('footer_logo', ''),
  '#upload_location' => 'public://footer_logo/',
);

When I call the image using theme_get_setting('footer_logo'), I just get a set of numbers. How can I get the file path of the image instead? Also, is there away to pass the image through image cache settings.


texts:
I am working on entity forms in drupal 7, I want anonymous users to be able to post content and then create an account, the problem is that by the time they create an account, any previous submission is already attached to "anonymous user".

I want to change the code so that when anonymous user posts, their content can be attached to the latest created users

Below is my code so far but it is not working.

if (empty($user->uid))  {
  $result = db_query('SELECT u.uid FROM {user} u ORDER BY u.uid DESC LIMIT :d',array(":d"=>1));
  while ($record = db_fetch_object($result)) {
    $uid = $record->uid; // last created user id .
  }
  $entityform->uid = $uid;
}


texts:
How do I remove an entity type via drush?

List of entity types I can get via:

drush eval 'print_r(array_keys(entity_get_info()));'

Array
(
    [0] => node
    [1] => taxonomy_term
    [2] => comment
    ...


texts:
I looked over the theme suggestion but when tried with dummy text, the block doesn't show any dummy text.

on view source, it showed "id=block-menu-menu-top-menu-navigation"

Tried naming block--top-menu-navigation.tpl.php and block--menu-menu-top-menu-navigation.tpl.php but dummy text still doesn't show up.

Perhaps my naming the files is wrong?


texts:
I am seeing the following:

The block X was assigned to the invalid region footer and has been disabled.
The block Y was assigned to the invalid region footer and has been disabled.
The block Z was assigned to the invalid region footer and has been disabled.
The block W was assigned to the invalid region search and has been disabled.

Here is my code

array(
  'module' => 'W',
  'delta' => 'form',
  'theme' => $admin_theme,
  'status' => 1,
  'weight' => 0,
  'region' => 'search',
  'pages' => '',
  'cache' => -1,
  'visibility' => BLOCK_VISIBILITY_NOTLISTED,
),
array(
  'module' => 'X',
  'delta' => '1',
  'theme' => $admin_theme,
  'status' => true,
  'weight' => 0,
  'region' => 'footer',
  'pages' => '',
  'cache'  => -1,
  'visibility' => BLOCK_VISIBILITY_NOTLISTED,
),
array(
  'module' => 'Y',
  'delta' => '2',
  'theme' => $admin_theme,
  'status' => true,
  'weight' => 0,
  'region' => 'footer',
  'pages' => '',
  'cache'  => -1,
  'visibility' => BLOCK_VISIBILITY_NOTLISTED,
),
array(
  'module' => 'Z',
  'delta' => '3',
  'theme' => $admin_theme,
  'status' => true,
  'weight' => 0,
  'region' => 'footer',
  'pages' => '',
  'cache'  => -1,
  'visibility' => BLOCK_VISIBILITY_NOTLISTED,
),

);

Any suggestion greatly appreciate it. I have other blocks that have properly worked using this method with the custom theme. But the above in $admin_theme = 'seven'; are not working.


texts:
I think, this labels and its translations are available, but I don't know where. I found nothing in the "Translate Interface" seach.

So here's my question:
is there a way to get translated month labels more elegant as like t('january') ?


texts: Why is "/es" showing up twice in my URLs?

texts:
I have a bilingual website using locale.

I have a content type that has the "link" field.

I have an Image Slider created with Views with the link as one of the fields.

The url in the link field is "services".
In English, this works fine and goes to

www.domain.com/services

While viewing the view in Spanish, it adds "/es" to the URL twice

www.domain.com/es/es/services

Instead of:

www.domain.com/es/services

Is this an issue with pathauto? Views? Link?


texts: How to get translated field using Twig tweak?

texts:
I use twig tweak for rendering username on site this way:

username.html.twig:

{#
/**
 * @file
 * Theme override for displaying a username.
 *
 * Available variables:
 * - account: The full account information for the user.
 * - uid: The user ID, or zero if not a user. As used in anonymous comments.
 * - name: The user's name, sanitized, and optionally truncated.
 * - name_raw: The user's name, un-truncated.
 * - truncated: Whether the user's name was truncated.
 * - extra: Additional text to append to the user's name, sanitized.
 * - profile_access: Whether the current user has permission to access this
     users profile page.
 * - link_path: The path or URL of the user's profile page, home page,
 *   or other desired page to link to for more information about the user.
 * - homepage: (optional) The home page of the account, only set for non users.
 * - link_options: Options to set on the \Drupal\Core\Url object if linking the
 *   user's name to the user's page.
 * - attributes: HTML attributes for the containing element.
 *
 * @see template_preprocess_username()
 */
#}
{% if link_path -%}
  {{ drupal_field('field_name', 'user', uid) }}{{ extra }}
{%- else -%}
  {{ drupal_field('field_name', 'user', uid) }}{{ extra }}
{%- endif -%}

But this doesn't work with translation. How to get translated field?

4k4 answer this way:

{{ drupal_field('field_name', 'user', uid, user.langcode.value) }}

But I don't need language from session/url, not from user settings


texts: When I add a context filter, my view is wrapped in a div

texts:
I created a view block to display a button (join / leave) above my groups. When I add a context filter to my view, it is wrapped in a div without "class" and "id".

1) I added to my view the following context filter:

(Group content User) User: User ID

2) When the filter value is NOT available: Provide a default value: User ID of the logged in user

Here is the result :

       Rejoindre le groupe

If I delete the context filter, the div envelope would disappear, but that's not the view I want:

 Quitter le groupe

 Quitter le groupe

I encounter this problem with other block view, it's really weird. An idea ?


texts:
I'm trying to make a block, with views, that shows me a list of nodes that has the same term of the node that I'm viewing:

I open node/1 that has a term reference field to the term "10"
I want to display other nodes that have a reference to the same term

I use a contextual filter, but how should I pass the term?
Have I to use a php value as default argument?