texts: My drupal 7 is very slow even if I did many improvements

texts:
I'm builind a Drupal 7 web site using commerce kickstart 2 distribution, the site became very slow, mainly the admin pages.
I read many answers here in stackexchange, and some articles talk about drupal performance, so I did the following steps :

disabling some modules :update manager,Internationalization,Localization update,database logging.
setting cron running to: never
enabling cache pages for anonymous users and enabling cache block
enbaling: Aggregate and compress CSS files and aggregate JavaScript files.
adding this line to settings.php: ini_set('memory_limit', '512M');

After one day my site back to work normaly, but today it's back slow as first time.

I'm using a shared hosting, so I went so Cpanel>select your php version> I enabled the following extension : apc,memeache,memecached.
 I also set memory_limit to 512 (I'm not sure if this settings requires a server restart).
Even If all this steps, thi site still very slow and I don't know what I can do.


texts: How do I disable fields for a user account?

texts:
The site I am developing has 2 type of profiles: the main account, and the alternative account associated with it. The alternative user gets blog posts, forum posts, under its own name. "He-man" and "Frodo" could be two examples.

The main accounts have signature, and image fields that never apply to them because the system always defaults to the alternative account for these things.

Since alternative accounts, and the main accounts both have different roles/permissions, how can I hide these fields using permissions?

I see that http://drupal.org/project/user_picture_field can be used to hide the picture field by setting permissions. How can I hide more than just the picture?


texts: rules_invoke_component() - Getting the value of the Provided Variable

texts:
In my code, I am using rules_invoke_component() to invoke a Rules Component.

On that Rules Component, have 2 variables.

Parameter
Provided

I am successfully able to invoke the Rule and send the Parameter Variable to it (In this case it was $node). But I am just confused on how to get the value of the Provided Variable.

Is that possible?


texts: Anonymouse users can't see Openlayers Data Overlay

texts:
I have a map view displaying the Openlayers Data Overlay. It's displaying a list of GPS tracks from a "Map Feature" content type I made.

Logged in with the Administrator, I can see all the tracks on the map fine. The preview for the Data Overlay shows all the data coming through great.

When I few the map as an Anonymous user, not logged in, none of the GPS tracks show up. The map displays on the page but none of the data from my Data Overlay.

I've looked all over the place trying to find content permissions that are wrong that are screwing things up but I can't find anything.

Why is the data on the map showing for the administrator and not Anonymous users?


texts: How can we find the js file is included before or not in drupal

texts:
I have some functions in template.php file that inside some of them, some js files must be included to the template.

Now, I want to check at first whether a specific js file [for example jquery.min.js] is included before or not. (in order to avoid) duplication.

Is there any way to check this issue in drupal 6??


texts:
I've got a field (URL) which contains a custom external URL for each node.
My goal is to set this custom url as link on the title which is displayed in a View. This is currently linked to a detail page (mydomain/node/5).

Unfortunately, I can't get it to work. How can I solve this?


texts: "Languages" not found in Admin/Configuration

texts:
I have a Drupal 7.41 in a remote server linux configuration

Installed and Enabled

Internationalization
Locale
Variable
Entity Traslation
Content Translation

Next, want to Add the Spanish and French languages. But, there is no Languages option seen under "Regional and language" in Admin/Configuration.

What is missing?
Tried flushing all caches. No difference.
Logged in as admin user/1


texts: How can I have links to anchors in menus?

texts:
How can I add a menu link as /test#anchor and link to #anchor section on the test page?

I need to add a menu item that links to specific section on the target page. Drupal 7 had menu tokens to achieve it. How can I do this in Drupal 8?


texts: filter entity reference by another entity reference field in create content

texts:
there is two content types "country" and "state".
content type "state" has entity reference field for "country".

there is another content type called "shop" which has two entity reference field for "country" and "state".

when i creating "shop" it display all the "state" .

but i want something like when user select one country, the corresponding states to the country should display.

how to do that help needed .


texts: #required attribute not letting me to redirect a drupal 7 form

texts:
I have a form with 2 buttons. One is a submit button and another is a simple button when clicked, the page has to be redirected to another page.(I mean the user has to be redirected even if he hasn't filled in the entire form)

So after the submit button I put the following code for the other element

<?php
$form['health_calorie_consume']['view'] = array(
          '#type'=>'button',
      '#value'=>'View stats',
    '#validate'=>array('mymodule_form_view'),
     );
?>

inside the mymodule_form_view() function, I put the below code,

<?php
function mymodule_form_view()
  $form_state['redirect'] = 'http://localhost/d7/?q=node/3';
?>

To my surprise, Thhe function gets called but its not redirected..! and shows errors that some of the form fields with #reuired attribute haven't been filled out..! I tried using drupal_goto()function, it redirects to the other page properly but even in the redirected page those, "required" errors show up..!!

I even tried making #required attributes FALSE, inside the mymodule_form_view()and yet it didn't work.

So how to solve this problem..??


texts:
I have a main menu block which i am showing at top-navigation.
I need to theme main menu but not sure how to apply classes to the root level menu items and sub menus.

i tried below snippet but not getting result. Can anybody tell me how to achieve this.

   $main_menu,
  'attributes' => array(
  'id' => 'main-menu',
  'class' => array('links', 'navlist1', 'clearfix'),
  ),
  ));
  ?>

Below is the screenshot image which output i want to show in main-menu


texts:
The feature are coming into override state always. After running 'revert', it goes into default state and everything is fine,however. My client are unable to do the revert every single time its being enabled.
Why is it coming into override state always? There are no changes made... fresh install, enabled and it is in override state. Running diff shows:

Component type: fe_block_settings
        ),
        'cascade' => array(
<         'region' => 'page_header',
---
>         'region' => 'sidebar_first',
          'status' => 1,
          'theme' => 'cascade',
<         'weight' => -10,
---
>         'weight' => -1,
        ),
        'seven' => array(
        ),
        'cascade' => array(
>         'region' => 'help',
>         'status' => 1,
          'theme' => 'cascade',
        ),
        ),
        'cascade' => array(
<         'region' => 'sidebar_first',
<         'status' => 1,
          'theme' => 'cascade',
<         'weight' => -11,
        ),
        'seven' => array(
        ),
        'cascade' => array(
>         'region' => 'sidebar_first',
>         'status' => 1,
          'theme' => 'cascade',
<         'weight' => -9,
        ),
        'seven' => array(
        ),
        'cascade' => array(
<         'region' => 'navigation',
---
>         'region' => 'footer',
          'status' => 1,
          'theme' => 'cascade',
<         'weight' => -9,
---
>         'weight' => 10,
        ),
        'seven' => array(
        ),
        'cascade' => array(
<         'region' => 'user_popover',
<         'status' => 1,
          'theme' => 'cascade',
        ),
          'status' => 1,
          'theme' => 'cascade',
<         'weight' => -8,
        ),
        'seven' => array(

Component type: variable
      'api_version' => 1,
      'name' => 'site_name',
<     'value' => 'Cascade ',
---
>     'value' => 'Cascade Site',

As you see one is variable 'site_name'. This variable is not changed, so i am coming to conclusion that when enabling the feature it is not setting the variable 'site_name'. Can it be true? if so, why and how to fix? The same seems to be the case with fe_block_settings. I really would appreciate your help as this is becoming the case with many of my features. I would really like become good at troubleshooting and understanding features. Thank You a lot


texts:
I am using Ubuntu 14.04 . When I try to download, enable, disable any module drush gives the following error:

Additional uncaught exception thrown while handling exception.OriginalDrupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in Drupal::getContainer() (line 129 of /var/www/html/gitrepo/drupal/core/lib/Drupal.php).Drupal::getContainer()
drupal8_bootstrap(0)
_drush_bootstrap_drupal_configuration()
drush_bootstrap(3, 7)
drush_bootstrap_max()
drush_bootstrap_to_phase(-2)
Drush\Boot\DrupalBoot->bootstrap_and_dispatch()
drush_main()
AdditionalDrupal\Core\DependencyInjection\ContainerNotInitializedException: \Drupal::$container is not initialized yet. \Drupal::setContainer() must be called with a real container. in Drupal::getContainer() (line 129 of /var/www/html/gitrepo/drupal/core/lib/Drupal.php).Drupal::getContainer()
Drupal::theme()
_drupal_log_error(Array, 1)
_drupal_exception_handler(Object)
Drush command terminated abnormally due to an unrecoverable error.                                                                                [error]


texts: How to customize default add content page

texts:
I want to customize the default add content page, more specifically, to get rid vertical tab in the bottom, and add explanation text to each field.

How can i do this?
what php file should i tinker ?
is there already some modules to to this ?

thank you for reading this.


texts:
I am tring to get DRUSH (drush-master) up and running on a CentOS release 6.8 (Final) virtual server using PHP version 5.6.22. I will copy the php & DRUSH outputs below including the final error message:

Looking through the forums there is mention of the cause being an outdated version of PHP. However, I've checked the requirements and am pretty sure these versions should be compatible.

[server2 drush]# which drush
/usr/bin/drush
[server2 drush]# ls -lart /usr/bin/drush
lrwxrwxrwx 1 root root 35 Sep  2 16:05 /usr/bin/drush -> /usr/local/drush/drush-master/drush*
[server2 drush]# /usr/bin/php56 --version
PHP 5.6.22 (cli) (built: Jul  5 2016 15:31:36)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
[server2 drush]# /usr/bin/php56 /usr/bin/drush

  Parse error: syntax error, unexpected '[' in /usr/local/drush/drush-master/includes/preflight.inc on line 248


texts: Adding the current node title as the value of the comment form title?

texts:
I want a value to be automatically added to the title text-field in the comment form ; this value would be indeed the current node title.

I've started working on a hook_form_alter() (added in a custom module already installed and enabled) like this one :

   function ta_module_form_alter(&$form, &$form_state, $form_id) {
   if ($form_id == 'comment-form') {
        $form['comment']['title']['#value'] = 'Blablabla';
    }
   }

But as you might guess it's not working... I've got several issues:

Is the $form_id the right one ?
I didn't manage to successfully use print_r($form) (or it returned nothing) so I
guessed the path to the title value. Might be incorrect too...
And finally, I really don't know how to get the current node title
variable, so as to attribute it the title value!

Thanks for reading, I hope I've been understandable !  ;)


texts: Create renderable nested tree array like Menu Tree or Taxonomy Tree

texts:
I am getting a nested array with children property from the WebSerice. I want to create the render able array so that I can use "drupal_render" function to render final HTML. I looked at the 'menu_tree_output' and 'taxonomy tree" that Drupal generates, but there is not proper documentation that mention how to structure the array to make it render able nested list.

Lets make it short: How do I restructure the final array that I get from Webservice so that I can make it renderable using drupal_render api. Final output is nested list(Folder tree).


texts:
I have a content type shortcut with the fields field_namespace and field_active. Additionally, I have a Taxonomy term vocabulary named namespace that is used in field_namespace.

Example content:

Title       | Namespace   | Active
------------+-------------+-------
Shortcut 1  | Namespace A | True
Shortcut 2  | Namespace A | False
Shortcut 3  | Namespace B | False

Now, I have a view displaying a list of these Taxonomy terms as a table. A column of this table display the number of Shortcuts tagged with the particular term. Example:

Namespace   | Shortcut count
------------+---------------
Namespace A | 2
Namespace B | 1

I built this using a Views Relationship with Taxonomy term: Content with term. I used this relationship to add the Field Shortcut: Nid with the Aggregation Type COUNT DISTINCT.

What I now want: The Shortcut count shall only consider Shortcuts whose field_active is True, i.e. the output shall be:

Namespace   | Shortcut count
------------+---------------
Namespace A | 1
Namespace B | 0

So the COUNT DISTICT aggregation shall be somehow filtered by the value in field_active.

Is there an UI way to do this? If not, which hook is appropriate to do it programmatically?


texts:
I am using WYSIWYG editor with IMCE for article description, the issue is that once i upload an image file with imce, its showing image path like

  /DirectoryName/sites/default/files/image.jpg

Once we hosted website from local to online server, image is not showing because now DirectoryName is changed to some other name.

Any suggestions?


texts: Easy Way to change all instances of 'Content Types' in admin to a different phrase

texts: For a project I am working every Content Type available to a user is a 'Survey'.  The terminology 'Content Type' confuses the users.   I was wondering if there was a simple way to change all menu instances of 'Content Type' to 'Survey' in the admin.  I was thinking use hook_page_alter but this could grow teduios and be difficult to maintain.  Has anyone ever done this before? Thank you.


texts:
I'm trying to set up 3 or 4 level dependent. The options change as expected, but I want to hide the third and fourth options (the OK button in this case) when the first dropdown selection is changed.

I have also used #states but it doesn't have any effect.

How do I achieve that?

<?php

function myform_form($form, &$form_state) {
  $form['dropdown_form']['selection_one'] = array(
    '#type' => 'select',
    '#title' => t('Selection One'),
    '#options' => _load_selection_one(),
    '#ajax' => array(
      'event' => 'change',
      'callback' =>'dropdown_form_selection_two',
      'wrapper' => 'selection_two-wrapper',
      'effect' => 'slide',
    ),
  );

  $form['dropdown_form']['wrapper'] = array(
    '#prefix' => '
',
    '#suffix' => '
',
  );

  $options = array('- Select selection_two -');
  if(isset($form_state['values']['selection_one'])) {
    $options = _load_selection_two($form_state['values']['selection_one']);
  }

  $form['dropdown_form']['wrapper']['selection_two'] = array(
    '#type' => 'select',
    '#options' => $options,
    '#ajax' => array(
      'event' => 'change',
      'callback' =>'dropdown_form_selection_three',
      'wrapper' => 'selection_three-wrapper',
      'effect' => 'slide',
    ),
  );

  $form['dropdown_form']['wrapper']['wrapper-selection_three'] = array(
    '#prefix' => '
',
    '#suffix' => '
',
  );

  $selection_three_options = array();
  if(isset($form_state['values']['selection_two']) && $form_state['values']['selection_two'] != 0) {
    $selection_three = _load_selection_three($form_state['values']['selection_two']);
    foreach($selection_three as $key => $info) {
      $selection_three_options[$key] = $info['value'];
    }
  }

  $form['dropdown_form']['wrapper']['wrapper-selection_three']['selection_three'] = array(
    '#type' => 'checkboxes',
    '#options' => $selection_three_options,
    '#states' => array(
      'invisible' => array(
        ':input[name=selection_two]' => array('value' => '0'),
      ),
    )
  );

  $form['dropdown_form']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('OK'),
    '#validate' => array('dropdown_form_validate'),
    '#submit' => array('dropdown_form_submit'),
  );

  if(empty($form_state['values']['selection_one'])) {
    $form['dropdown_form']['wrapper']['selection_two']['#attributes'] = array('style' => 'display:none');
  }

  return $form;
}

function dropdown_form_selection_two($form, $form_state) {
  // Return the dropdown list including the wrapper
  return $form['dropdown_form']['wrapper'];
}

function dropdown_form_selection_three($form, $form_state) {
  // Return the dropdown list including the wrapper
  return $form['dropdown_form']['wrapper']['wrapper-selection_three'];
}

?>


texts: Nothing returned from taxonomy_term_load function

texts:
The --very normal-- taxonomy_term_load() doesn't seem to be able to load entities within a custom menu callback. Yet I can access a profile entity, load fields, and get the field tids, but I get nothing from the taxonomy load function!

function mymodule_menu() {
  $items = array();
  $items['user/account-convert'] = array(
    'title' => 'My Page',
    'page callback' => 'mymodule_page',
    'type' => MENU_NORMAL_ITEM,
  );
  return $items;
}

function mymodule_page() {
  global $user;
  $profile = profile2_load_by_user($user, 'my_profile_type');
  // Sanity check tid return. Success.
  echo $profile->field_profile_myfield[LANGUAGE_NONE][0]['tid'];
  // Term name returns nothing. The object just won't load.
  echo taxonomy_term_load($profile->field_profile_myfield[LANGUAGE_NONE][0]['tid'])->name;
}

This makes absolutely no sense.

I have even sanity checked outputting hard coded tid's like echo taxonomy_term_load(1708) after 100% confirming it's a valid tid value.

Additionally I followed the function tree up and tried calling taxonomy_term_load_multiple
 directly, and entity_load directly. All give me nothing.

Furthermore I can confirm the function is valid and available at that point with function_exists, and the lack of undefined function errors.


texts: RDF core module doesn't seem to work after security upgrade

texts: I updated from Drupal 7.36 to 7.38 for security reasons. Now the nodes don't get displayed in RDF any more. For example: http://bartoc.org/en/node/112, add .rdf and you get the message "The requested page "/en/node/112.rdf" could not be found." The RDF core module is checked. Am I missing something?


texts:
on a website I'm working this period i have this problem with Taxonomy term View:
My scenario is like this : I've created a vocabulary with terms and sub-terms for my products categories. So for example there is a structure like this:

First Category: Computing-->Laptops (Apple, Acer, Dell)-->
 Desktops (CPU, RAM, Hard Drives, VGA)--> Servers (HP, Dell, Cisco, IBM)

Second Category:Peripherals--> Monitors (Samsung, LG,Dell, Asus)-->Keyboards (Logitech, Microsoft)--> Printers (Epson, HP, Samsung)

I'm using taxonomy term view to make the taxonomy term page to show the products in a grid using fields. Everything works fine, when i click for example on Dell i see XPS14, XPS14Z, XPS15 etc in a grid format with a thumbnail picture and the title below it. (I' created a field for thumbnail for every product).

What i want to do is when i click on Computing for example, to show only Laptops, Desktops and Servers with a thumbnail for each one and not all the products for Computing term ( Apple,Acer,Dell,CPU,RAM,Hard Drives...etc) as it happens now. I've tried to put some contextual filters from the view but i didn't figured out how to accomplish it yet.


texts: How to show contextual links buttons in templates with minimal markup?

texts: I want to get rid of the most markup in Drupal 8 templates, but still want to have working contextual links. How to do this?


texts: How do I include linked data to a Page in Page manager?

texts: Given two pieces of data, for example two entities, two nodes; when viewing one of them, how do I pull in data for the other one into Page manager/Panels?


texts: Automatic copy node from Drupal A to Drupal B

texts:
Drupal A and B are different domain (example: drupal A: www.aaa.com and drupal B: www.bbb.com)but at the same server.
At Drupal A, there are lot of fields, but I only need to send date field value to Drupal B (Everytime when it update or add new content). Drupal B will get date value and display at the content page. May I know how to do that?

I had tried Deploy (not working at all)
How to add data from one Drupal site to other?

I had tried aggregate but I send everything to Drupal B.

I need help. Many thanks.

For far my current solution is:
At Drupal B: php code connect drupal A database and get the date vaule. Echo to display at the content page.


texts: use xmlrpc to authenticate and create a node via services module 3.x and drupal 7

texts:
I want to use services module 3.x, drupal 7 and xmlrpc to create a node from a php client. However, I don't know how to deal with the authentication. I enable the session authentication but I don't know what I should do and I get error: HTTP/1.0 401 Unauthorized: Access denied for user anonymous.

ps: I can get session name and session id from user.login


texts: Commerce: add Verisign logos on checkout page

texts:
In Drupal Commerce, I want to add a Verisign or other security seal logos to the credit card checkout area.

Where is the corresponding template file I can add this too?


texts: Drupal Commerce: Views and Contextual Arguments for Date Range

texts:
So, asked this question over at Drupal Commerce forums, and they directed me here:

I am looking for a simple way to select a part/product by the year in which it was manufactured, under a generation of products.

For instance, selecting a Schwinn bicycle model, manufactured between the years of 1971-1973. I have looked at Apache Solr and facets, but running a Solr instance looks to be a bit resource and database intensive.

I'd like to this with minimal code, if at all possible.

Thanks in advance for your answers, and for all the independent support and thought that has gone into this module.

P.S.

As an aside, if anyone needs to do bulk product editing, I suggest creating a view, and then turning off "Overlays" under the "Core Modules" section. It makes things far more responsive, and easy to organize.

Original method suggested by forum:

I'd add a manufacture date datefield (using Date module) to the product. You could then use exposed filters on the date to provide blog-style listings (using arguments == contextual filters) in views. bicycles/manufacturedate/1994

and the followup clarification:

This method works for a single year, but not for a range of years. Unfortunately, some of my products have model ranges that span 12 years. Unless I am missing something, I would need a separate date field for each year to use the method suggested.

Is there a way to do a range of years, using a value such as 1953-1964...such that a product manufactured in 1967 would show up for that range?


texts: Allow HTML style attribute for filtred HTML

texts:
I'm using the Wysiwyg module with CKEditor 3.6.6.2.7696. The HTML attributes is disallowed in HTML text format, so I can't use font-size and text-align.
Any solution please?


texts: Change template of Drag & Drop module on node add form

texts:
I am using Drag & Drop Upload module for multiple images uploading.

But the template I see on node add form (FRONTEND) is this :

And I want to change it to this :

I don't know where can I find the HTML for this template, so I can change it.

Thank you so much for your help!


texts: How do I control user generated contents published state?

texts:
I want to allow users to submit the content to my site, but the content must be first approved, and then it can be published.

Someone told me to write a module, but I don't know which steps to follow.

Let the current user see the content that it is published by him, which is still not approved.
In addition, create a form to allow the current user to edit the node.

Does anyone know how to write such module?


texts:
Using Drupal's admin I added to an existing content type a new text field with the machine name field_note.

When fetching the field in my code I want to check if $field_name == 'field_note' but it never does. When printing the value of $field_name I get field_note (should match).

Anyway, after a long process and looking at the hex values of both strings I found out that $field_name has 3 additional control characters at its end - the LRM (left to right mark).  My workaround for this was using the following code:

$field_name=preg_replace('/\p{C}+/u', "", $field_name);

This works well, but I really want to understand why this happened? I have dozens of fields and only now this started happening with new fields.

A really big clue might be a recent upgrade from Drupal 7.23 to 7.63, but checking the database and field table they all remained with the same encoding.


texts: How do I create a content type that has another content type embedded inside of it?

texts:
I'm building a content type for a journal-type product. In each journal there are a number journal articles that vary from journal to journal, which have their own unique fields (like author, date, subject, synopsis, etc). Right now I've set it up so you fill out all of the contents for the articles and then you pull them into the journal via entity reference.

Ideally though, it would be great if I could just streamline all of this into the same "create content" form. For example, when I click "create new journal", I want to get all the fields for my journal plus the ability to dynamically add journal articles and all of their fields.  It could be in a different tab or something, it just needs to be in the same create journal content type form.


texts: I'm creating a form in a module but when I try to add a radio group the title displays but not the options

texts:
$form['todo'] = array(
'#type' => 'fieldset',
'#prefix' => '
',
'#suffix' => '
' . $image,
'thot_dialog' => array(
  '#type' => 'fieldset',
  '#prefix' => '
',
  '#suffix' => '
'
),
'add_thot' => array(
  '#type' => 'fieldset',
  '#prefix' => '
',
  '#suffix' => '
',
  '#title' => t('Add New Thot, Related to Current Thot'),
  'new_thot_nid0' => array(
      '#type' => 'hidden',
      '#default_value' => "",
  ),
  'new_thot_name' => array(
      '#type' => 'textfield',
      '#title' => 'Name Your New Thot:',
      '#default_value' => 'Type Name Here',
  ),
  'new_thot_rel' => array(
      '#type' => 'select',
      '#title' => 'Select One:',
      '#options' => $t_rels,
  ),
  'new_thot_reverse' => array(
      '#type' => 'checkbox',
      '#title' => 'Reverse the direction?',
      '#attributes' => array('#id' => 'new-thot-reverse'),
  ),
  'new_thot_options' => array(
      '#type' => 'radios',
      '#title' => 'Choose One',
      '#title_display' => TRUE,
      '#options' => array(0 => 'Create the Thot', 1 => 'Edit the Thot (Add text, etc.)'),
      '#access' => TRUE,
      '#default_value' => 0,
  ),
  'new_thot_submit' => array(
    '#type' => 'submit',
    '#value' => 'Submit Thot',
  ),
);


texts:
I am new to drupal, but i have a requirement with form submission .For this i have created a static block . In that block some input types are there like dropdown menu, checkboxes radio button etc. When user clicks on preview button i am able to fetch the data into bootstrap modal dialogue box.So in that modal dialogue form, submit button is there.But when i try to submit the values from modal dialogue box those values are not posted. Those values sent to url.

For this i am using normal $_POST method.

I have placed this code in the block section like regualr php .

if(isset($_POST['sendtorfq'])
{
  print_r($_POST);
}

<form name="rfq_form id="rfq_form method="post">
  <input type="submit" class="btn btn-primary" name="sendtorfq" value="SendData">
</form>

But it takes form method as GET. and when i place the mouse on the submit button it shows
the url of that page like /process?name=somename&email=someemail.Every time when i submit the form values are posted to url . But not to post method. Please suggest me  where i was wrong?


texts:
If I have a custom CCK field, for example "temperature", is there any way I can directly call it from the node template? Like would there be a $temperature variable?

Thanks!


texts: Why is my javascript not being executed?

texts:
I have a Drupal 8 form and I'm applying some custom javascript to it. I've added a JS file, and a libraries file for my module containing a reference to it, but the code doesn't run.

in module_name/js/autocomplete.js

(function ($, Drupal, drupalSettings) {

  Drupal.behaviors.modulename_autocomplete = {
    attach: function (context, settings) {

      jQuery(function() {
        // Doesn't work
        console.log('foo');

        // Doesn't work
        alert('bar');

      });
    }
  };
})(jQuery, Drupal, drupalSettings);

and in module_name.libraries.yml

module_name.autocomplete:
  version: 1.0
  js:
    js/autocomplete.js: {}
  dependencies:
    - core/jquery
    - core/jquery.ui.autocomplete

As the comments suggest, I see no console messages and no alert, so it's clear the behavior is not being executed.

What do I need to change for this to work?


texts: D7 Execute javascript on views exposed filters AJAX submit (Dropkick)

texts:
I need a tutorial on how to run a piece of javascript after the AJAX form of a views exposed filter group submits.

The problem is with using the Dropkick javascript plugin to style some dropdowns. The Drupal Dropkick seems to do a half-decent job of implementing this on the initial form, but after AJAX submit the dropdowns lose their styling.

If it helps, here's a copy of the Drupal Dropkick module js:

(function($) {
  Drupal.behaviors.dropkick = {
    attach: function(context) {
      $(Drupal.settings.dropkick.selector, context)
        .not('#field-ui-field-overview-form select, #field-ui-display-overview-form select') //disable dropkick on field ui
        .each(function() {
          $(this).addClass('dk-active').dropkick({
            change: function(value, label){
                $(this).change();
            }
          });
      });

      //add clearfix to parent .form-item to fix floats
      $('.dk_container').parents('.form-item').addClass('clearfix');
    }
  }
})(jQuery);

Any thoughts?


texts: Display Comment Wrapper for Anonymous users

texts: I would like to display comment-wrapper.tpl on a node to anonymous users, even though they have to login to comment and even when there are 0 comments on the node. Ideally it would display the wrapper with a "Login or register to comment" underneath. Any ideas?


texts: Why to use [attributes] when adding class to a button inside my hook function

texts:
I request somebody to please explain why I have to use ['#attributes'] when adding one or a combination of CSS class-es to the Submit button inside a search-block-form but when changing just the Text, ['#attributes'] is not required?

To change default text of the button I am writing:

function ezone_form_search_block_form_alter($&form, &$form_state, $form_id){
    $form['actions']['submit']['#value'] = t('Search now');
}

But when adding a CSS class to the same button I have to write this:

function ezone_form_search_block_form_alter(&$form, &$form_state, $form_id){
    $form['actions']['submit']['#attributes']['class'][] = 'btn btn-primary';
}

Why although value and class both are attributes of a button element, I have to do them differently? If I take out the ['#attributes'] part ($form['actions']['submit']['#class'][] = 'btn btn-primary';) button classes don't not render.

I Googled but could not find anything specific about it! It would be great if someone can put lights on this. I am a new comer at Drupal platform!


texts: Help on how to even get started with OpenLayers3

texts: I am tired of looking. I can't even get a pin to drop on one of these maps why is it so complex to do something simple? Okay, enough whining I have found plenty of information on the 2.0 beta blah blah but what about this new version with the different UI (3.1). Please, someone, point me in the right direction for help or for everyone's sake that hasn't been using the last 75 versions make a tutorial. Thank you in advanced from stopping my head from exploding and for my wife not divorcing me.


texts:
I am using Drupal 8.9.
I have 2 content types Teacher and Subject. Teacher has 2 reference fields of content type Subject (first one is the subject which the teacher is teaching and second one is the subject which the teacher lectures).
My desired functionality is that the teacher chooses Subjects which he teaches or lectures and then teacher's name automatically shows in corresponding Subject under corresponding title (teacher or lecturer) with link to teacher's page.
I am a total newbie in Drupal as I am doing this as my school work, so please be patient with me :)


texts: What causes a search_api based view to stay cached for anonymous users even after the index is updated?

texts:
I have a search api based view. The index this view is based on indexes new content as soon as it is published. When new contest is published, logged in users can indeed see the latest content at the top of the search results.
However, anonymous users don't see the newly published content until the cache is cleared. How do I avoid having to manually clear the cache? What should I check?


texts: Trigger Crop API programatically after node is created

texts:
Hi I am using Image Widget Crop so that users can crop images according to predefined image styles. All would have worked fine without any issues had I been using Drupal in the conventional 'monolithic' way. But I am not. Instead, I have a headless Drupal setup.
That means that I do not have a Drupal theme to render my content. The problem created because of that is that apparently (from what I've read online), the actual styled images created using Image Widget Crop/Crop API are actually created when they are called/loaded in a theme. Now the theme can be backend as well. Below is what I think this happens chronologically.

Create and save a post with an image cropped using Image Widget Crop.
Cropped/styled image does not get created in the file system.
Fetch the data using JSON API/Custom API Module
Returns with empty image field because cropped/styled image is not yet created.
Click on Edit post
Cropped/styled image created. Because the preview of the cropped image is called by the edit form/backend theme.
Fetch the data using JSON API/Custom API Module.
All works fine.

What I want to do is execute some kind of hook which creates the styled/cropped image when a post is saved(step 1). That way when I fetch the data using JSON API, it is readily available.


texts: Form API: Persistent values across submits?

texts:
Getting started with the form API. None of the examples seem to keep and redisplay the values the user entered. E.g.,  you have a "name" field. User enters "John" and hits Submit.

If the form data is invalidated for some reason, the name field should still show "John" so he doesn't have to enter it again. Is there a setting to set for persistent values? values vs. default_values?

Drupal 7 stock install


texts: How can I limit the number of email sent per hour in a rule?

texts:
I have installed Mime mail and Mail System modules. I use an action in a rule:

  Send HTML mail to all users of a role

to send an email to a set of users.

Is there anyway I could limit the number of email sent per hour? For example, if the execution of this rule has to send 100 emails, It will be sent in blocks of 50 emails per hour.

I think It should be queue in cron.


texts:
My ISP has a 1Gb limit and blocked my site.
The file grew to 16 Gb in less than a week. I emptied the watchdog sql file in the database with phpAdmin. This overcame the block and the site restarted, with an SQL error on the front end and hundreds of SQL errors on the back end, which still, nevertheless, will start.
In less than 10 minutes after emptying the file, the size had returned to 1 Gb. 45 minutes later, there were 250,000 rows occupying 3 Gb.

The site is normally quiet. It has had little in the way of addition in the last 6 months and serves about 200-500 pages a day.

The logged error is the following.

  Deprecated: assert(): Calling assert() with a string argument is deprecated in Drupal/Core/Plugin/DefaultPluginManager.php on line 151


texts: How do I add a cachebreaker to a specific image style in drupal 7?

texts:
I have one image style on my site that I need to add a cache breaker to.

Ideally I just want to add . '#' . time() to the end of the src URL.

For instance everywhere the large style is shown the src url is currently something like:

/sites/default/files/styles/large/public/image.jpg?itok=kdkdFf

With cachebreaker:

/sites/default/files/styles/large/public/image.jpg?itok=kdkdFf#1398670388

How do I go about doing this? hook_node_alter?

More info:

I set up a test image editor at http://blakedesign.co.nz/editor/ via Chrome uploading an image and then editing it works fine the modified image shows up in the preview.

On Firefox or IE it actually does work but the old unedited image gets redisplayed from memory.

This can be circumvented if a unique cachebreaker is appended to the source url every time the image is viewed.


texts: Share nodes and users across multiple sites

texts:
I understand sharing databases/tables is frowned upon as a practice, however, I need to share users and some nodes between two websites. What are the alternatives and what are the pros and cons of the most common strategies?

To give slightly more detail. I need to create a website for "staff and authenticated users" that is separate to a main site that the public anonymously accesses. On this secondary site there will be forums and chat functionality moderated by admins for both sites. I would like to avoid having the admin users re-log in when they are managing the second site.

I also need to allow for some future integration where some "logged in" user content appears on the main site.

Are the two alternatives for doing this only,

Make one giant single site
Share databases

or is there some other way?


texts: How can I style the webform submissions table?

texts: Using Drupal 9 and Webform, I'm unable to find the twig template used to output /contact/form/submissions.  Is there a place in the documentation that lists the twig templates?  I see there is a View created that looks like it has submissions, but disabling it doesn't break the page.  If there is a better way to style it, that could also work.


texts: hook_entity_view_alter // Undefined index: #entity

texts:
I have a basic module, works good returning data from a ECK bundle, though now, I've added some custom breadcrumbs using the snippet below, also works good. The only problem is, when I view other pages breadcrumbs running basic nodes, such as articles I get the error:

  Notice: Undefined index: #entity in theme1_entity_view_alter() (line
  92 of htdocs/example.dev/themes/theme1/template.php). Notice: Trying
  to get property of non-object in theme1_entity_view_alter() (line 93
  of htdocs/example.dev/themes/theme1/template.php).

/**
 * hook_entity_view_alter for customise breadcrumbs
 */
function theme1_entity_view_alter(&$build)
{
    $entity = $build['#entity'];
    if ($build['#view_mode'] == 'full' && $entity->type == 'event')
    {
      $breadcrumb = array();
      $breadcrumb[] = l('Home', '<front>');
      $breadcrumb[] = l('Whats on', 'whats-on');
      drupal_set_breadcrumb($breadcrumb);
    }
}

I understand that nodes are also entities, and think that hook_entity_view_alter() is also be called on nodes. If so, how do I fix this so only the entities in my bundle are altered and all other nodes ignored?

Many thanks, Barry


texts: Geo field proximity distance for exact location

texts:
I'm tried this for a day,but i won't get the answers. I'm using geo field proximity for zip code searching, it's working with 5,25,30 miles search, but i want to search exact location of zip code.

eg
    In search zip code : 73301, all the record in 73301 will be show.


texts:
In Drupal 7.63, I am trying to add a new rule, however I am being greeted with a WSOD. I am doing the following process...

Create a new Rule
Add condition
Select any condition from the drop down list

I then receive a WSOD with the following error in my browser console log:

Preceded by the warning:

  [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

I can see that other people have had this error in the past here, however I cannot see a solution to this. Similar to the referenced link I also have Advanced CSS/JS Aggregation installed (defaulted to jQuery 1.4.4).

Any help would be appreciated.


texts: Invalidating render cache items for anonymous?

texts:
We have a certain content type in Drupal 8 that has a small grid of data on it that is populated from an API call when the node view is being built.

In that call, I am checking for cache and setting cache instead of talk to the API every request:

if ($cache = $this->cache->get($cache_key)) {
  return $cache->data;
}

// $content = request...

$this->cache->set($cache_key, $content, REQUEST_TIME + 3600, ['mymodule']);

Where $cache_key is just mymodule:remote_id:subscription_id. My default cache bin is handled via Memcache.

The Drupal page cache time is set to 30 minutes, and Varnish sits in front of it for anonymous traffic.

I am noticing that even though my custom cache data is set for an hour timer, and the Drupal cache is set for 30 minutes, users are able to see data from 3 days ago but I am not sure how. As soon as I go view the site (authenticated) and refresh, the data updates.

I tried backtracking this but nothing jumped out as missing, perhaps other than some cache tags I might need to add. Even still, the render object is what is being shown from cache, which the data is a part of before it is cached, not the cached data item itself.

System cron is running every hour. Shouldn't it purge invalidated cache as part of system_cron?

Edit: I switched my local from Memcache back to the default cache (MySQL) and noticed render cache items all have an expiration of -1.

At what point are entity render cache items invalidated? I feel like that might be my issue, but not sure how to address it.


texts: Using Drupal Commerce, how do you render the "add to cart" button?

texts: I have created a custom node.tpl.php file for the product_display content type. I have everything worked out except I have no ideal how to isolate the "add to cart" button, actually the "add to cart" form, and render it within the template wherever I need it.


texts: Menu setting not visibile for other roles on Node Form

texts: In Drupal 8 I am creating Editor role with limited access, but the Editor cannot see "Menu Settings" while creating or editing content, this would be helpful when Editor add the node to the menu while creating node. I checked the permission and I can't see any option to turn on Menu Settings for the Editor role or for other roles.


texts: How to properly recognize a session id generated by drupal?

texts:
I'm storing stuff in a session that is sometimes handled by drupal. The session id is passed forward to another service, which checks back to the original server to get the session data.

When the session id is generated by drupal, i want to recognize it so i can include the drupal bootstrap instead of creating a normal php session. What would be a proper way to recognize drupal session ids ?

Is there a way to make it more specific, like change the sessionid myself ?


texts:
I have set the REST server with the Services module.

Also I've installed the Services Views module, created a new view that outputs the desired fields into XML.

That's working fine.

How can I add XML schema to that output, so the XML will look like:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
.....


texts:
I want to create a job system with the following workflow:

Administrator can add the jobs.
A page for job listings.
On detail job there should a link of apply for this job.
The form will contain the fields and upload application form.
The back end must display the number of application received for respective job.
On click on number of application received for respective job the see the list of Application received list for particular job category.

I have tried it with the Views and the Webform module.

Created a view for job listing and use webform for apply form. But what should I do with the trackers in point 5?


texts: Out of Memory when running update.php even with 512MB assigned

texts:
I have the same websites on two hosters (both shared hosting)

When I tried to update the latest views module on hoster1, then I get an out of memory fatal error. I get the error even when I assign 512M or 768M with memory_limit command in the settings.php

When I tried to update the latest views module on hoster2, all works fine. There I have 256M assigned.

Can it be that there are other memory restrictions given by a hoster, which I cannot control with the assigned memory?

Thanks for any help


texts: Does the $form['element']['#disabled'] = TRUE guarantee that the user cannot edit the field or is it just a UI setting

texts:
I have a form element like this:

$form['title'] = array(
  '#type' => 'textfield',
  '#title' => t('Subject'),
  '#default_value' => $node->title,
  '#size' => 60,
  '#maxlength' => 128,
  '#disabled' => TRUE,

);

Does this make the field 100% non-editable by the user or is it still possible to set a value for this field using manual form submission using jQuery / Postman to the action URL?


texts: drupal_mail() and names with apostrophes

texts:
When using drupal_mail to send an email, I get errors when display names (not emails) contain apostrophes in the "To" field.

For example, referring to drupal_mail() documentation, email addresses like "Another User <anotheruser@example.com>" are valid. "Another User <anotheruser@example.com>" validates perfectly, but "Another O'Neil <anotheroneil@example.com>" fails.

Do I need to change the last name to ONeil instead of O'Neil, or can escape it somehow?
I have also tried ""Another O'Neil" <anotheroneil@example.com>" without success.

Setup: Ubuntu 11.04 LTS
Drupal Version: 7.x
Mail Service: Amazon SES
Additional Mail Modules: "HTML Mail" and "Mail System"


texts:
In content type I added an image field.

Now when I try to add a content and upload an image, I am getting this error on page.

The file could not be saved. An unknown error has occurred.
File upload error. Could not move uploaded file.

CONFIG:

File system setting.

Public file base URL:

  http://drupal.com/sites/default/files

Temporary directory:

  sites/default/files/temp

Reading note about the Temporary directory:

  A local file system path where temporary files will be stored. This
  directory should not be accessible over the web.

Since its path is located inside Drupal, I am assuming that this causes the error.

Checking the system logs:

  "POST
  /node/add/finfeed1?element_parents=field_image/widget/0&ajax_form=1&_wrapper_format=drupal_ajax
  HTTP/1.1" 200 6434

PS: I have 777 on sites/default/files/temp


texts: Drupal Views field handler: how to unserialize an additional field data?

texts:
I'm developing custom Views field handler, which renders a "Reorder" button on Commerce Line Item View. I need to access to the 'data' field, which is a serialized array.
What is the best way to get serialized field data?

/**
 * Implements Reorder Line Item button field.
 */
class commerce_reorder_lineitem_handler_field_commerce_reorder_lineitem_button extends views_handler_field {

       ...

          function construct() {
            parent::construct();
            $this->real_field = 'line_item_id';
            $this->additional_fields['line_item_id'] = 'line_item_id';
            $this->additional_fields['order_id'] = 'order_id';
            $this->additional_fields['data'] = 'data';
          }

          /**
           * Render form element placeholder.
           */
          function render($values) {
            return '<!--form-item-' . $this->options['id'] . '--' . $this->view->row_index . '-->';
          }

       ...

}


texts: Mouseover overlay for images using Views Photo Grid

texts:
Trying to add a hover overlay for node title and a couple of other fields for images using  the views photos grid module.

The fields to be used in the overlay need be excluded from the display as the module only uses one image field, however I am not managing to add the excluded fields.

If I the preprocess to template.php

`function THEME_preprocess_views_photo_grid_style(&$vars) { $vars['raw_result'] = $vars['view']->style_plugin->rendered_fields;}`

I can print the titles using

`foreach ($raw_result as $row) {print $row['title']; }`

which prints the titles on the page outside the container as a row, but I can only add the last title to the overlay.
Need to be able combine each title to each image that is shown using

`foreach ($items as $key => $item):

print $item;
endforeach;


texts: Is there any way to add a region into html.html.twig? I want to have one inside  tag to be able to render different js counters through Block Layout


texts: Convert Drupal error message to JavaScript alert

texts:
How I am able to do that?

I'd like to show the status/error messages in form of an alert using JavaScript instead of showing it on the screen.


texts:
I am just taking on responsibility for a Drupal 6.2 site. It has some custom modules and some quite poorly organised code which I am working with developers to improve alongside developing new features to the site. And being fairly new to Drupal I am just getting my head around how it all hangs together.

One of the things I want to assess is when we should be planning to migrate to Version 7.

Is it a reasonable assumption that, as a commercial website, we should upgrade to version 7 as support for 6 drops away over the next year or so?
Is it possible to develop and refactor on version 6 in such a way to make that migration as painless as possible when we get to it?
Is there anything else I should consider as I plan the development roadmap over the next 12 months?


texts:
I am trying to create a custom button in Drupal 7.  The link which the href should be equal to is dependent on the context such as the current UID.

I have created a view which normally has a plain text output as [title].

I want to use that text output as part of a link field such as

http://my-site.com/page/title

so I had written the code for the above link as such:

<a href="http://my-site.com/page/<?php $block = module_invoke('views', 'block_view', 'profile3-block_4'); print render($block[content]); ?>">LINK TEXT

however the output seems as if it is placing part of a views div tag in the link instead. I tried stripping all html from the views block but no success.  Anyone got ideas? Could it be an improper use of quotes?


texts:
So i create new dialog:

$response = new AjaxResponse();
$modal = new OpenDialogCommand($title, $content, $options);
$response->addCommand($modal);
return $response;

can someone help me with code how to submit this new dialog?? I can't find online anything that works.


texts: SEO friendly URL for drupal commerce products

texts:
I am using Commerce Product Url module for generating unique url for commerce products like follows,

For each product it provides id parameter,

mycommercesite.com/node/1?id=1
mycommercesite.com/node/1?id=2

as well as sku parameter,

mycommercesite.com/node/1?sku=pr1
mycommercesite.com/node/1?sku=pr2

But I need SEO friendly URL for each product

for example,

mycommercesite.com/node/1/product1
mycommercesite.com/node/1/product2

Is there any way to do this?

Thanks.


texts:
We are running a system with 3 servers. Each have their own database, apache and boost configuration. We are using one master two slave databases. We even excluded all cache tables from synching. To explain the problem say: M1 is our master server, S1 & S2 are our secondary server. All anonymous users are forwarded to S1 & S2 . We used two domains one public facing PROD which is used via load balancer pointing to Server S[1-2], DEV that points to M1.

Now we have a webform that we like to use to collect contact query. We want any submission from S1 or S2 should go into M1.

Things we tried so far:

Webform Remote Submission This sandbox module. We had to tweak this a lot. At the end it works but if any validation fails the submission stuck in M1. We don't want to show DEV domain to our visitors.

Ajax Block This one solved few cases but we could not use that for webform.

Currently, we are planning to move ahead and create a custom module to handle this using core ajax framework. I would like to know if there is any better alternate or suggestion our there which can solve this more effectively.


texts: how to change autocomplete list user to select list user in Content Access?

texts:
I am currently using Content Access to set permission for node access right to specific user. My problem is that Content Access is using auto-complete to list all users, so are there any way to change that to select list widget so user can be easier to choose user instead of remember the user name?
Thanks,


texts:
Views with flexslider takes lot of times in rendering items/images.

Situation is that I have more than 5 flexslider carousels on the front page.
So I changed to go without view with flexslider.

I am trying to use flexslider carousel using template file.
Due to flexslider.css, I am not able to see .slides>li .

See following lines:

.flexslider .slides > li {
    display: none;
}

Even not able to see any slider movement there. Somehow I tried according to https://stackoverflow.com/questions/7539542/trying-to-get-flexslider-jquery-slider-to-work-with-drupal

Can anybody help me to create flexslider without view or manage display?
I want to create using tpl files.


texts: Generated PDF not using values selected from dropdown

texts:
I have a Drupal site that essentially is a product display where each individual item can be viewed with an "upgrade" from a dropdown menu.
Within this page the module mPDF is used to generate a pdf-version of the page with a custom print.css

Example;

Model X has the option for either specification A or B (these are selected from a dropdown menu). Everything works fine when viewed in the browser, but when generating the pdf I always get specifications for value A in the dropdown – even if I'm viewing the site with the values of B when pressing the button to download a pdf.

I'm guessing this has something to do with the fact that the page loads (reloads?) and drops my selected dropdown-value without me noticing, or perhaps I need to pass the dropdown variable to the pdf-generator in the first place somehow?

I'd rather not change the module since it works excellent apart from this issue (and chances are I might encounter the same problem even if I swap out the module), so any pointers on how to solve this would be truly appreciated.


texts:
I'm using the module image zoom to enlarge an image with the mouse over, also I use jCarousel to get a carousels in different pages.

In the image zoom module you have the option to get the thumbnail of the not selected images.
example :you have a node with 6 images, one will be big and the other will be thumbnails and when you click on one of them automatically it the big image will be swapped with the clicked one.

Now automatically those thumbnail are styled with the jquery carousel, I don't mind but the problem is that I cannot change the configuration of it! I cannot change horizanotal to vertical or other settings.

How do I fix it? Should I create the jcarousel by my self and uninstall the modules or is there a solution somewhere?

Thanks in advance.


texts: Can uploaded files be renamed in the server to avoid name collision?

texts:
I want my site to host some images. The user is able to upload images as a content type.

If two users create content and upload images with the exact same name (myImage.png), will the older image file be overwritten in the server (and therefore both content entries would end up with the same image file)?

If yes, it is rather troubling. So now I wonder: is there a module that renames the uploaded file so it will not collide with other uploaded files?

I have searched for a couple ones, not exactly tested them since they seem to add too much extra functionality I just don't need: I like the default file uploading system that comes with Drupal 7. I just want it to avoid name collisions (if it happens).


texts: Custom personal contact form with webforms

texts:
We want our users to be able to contact each other directly, but not give away the email address of the user account.

Personal Contact forms do just this, however, we need a few more fields and other triggers to happen alongside this. Things that webforms already does.

What I'd like to do is use a %get parameter to pass the id of the user they are contacting into the form, and pre-populate the email into a hidden field. This will allow me to use the webform email function to notify user 2 that user 1 would like to contact them.

So there are two users involved. User 1 = logged in user. User 2 = the person they are contacting.

The url would be mysite.org/webformid?uid=2

Where the uid is the id of contact 2.

Using that id, the webform could pull their email into a hidden form field.

Is this possible?

Heather.


texts:
As follow up to my previous issue, I think it would be nice to allow email address to be set as username for login. Or at least don't require username field and default it to use email address. This is a use case for Facebook login which allows email address be used as username for login.

When I try to run

{
"name": { "value": "test05@gmail.com" },
"mail": { "value": "test05@gmail.com" }
}

I am getting response

{
    "message": "Unprocessable Entity: validation failed.\nname: The username can not be an email address.\n"
}


texts: For Commerce, which UI display builders are supported?

texts:
I am trying to manage the display of products with Display Suite but have come across the issue of the display of variations and their prices. There was the suggestion in this issue but it is not a suitable alternative to use DS_Chains.

https://www.drupal.org/project/commerce/issues/2723689

Reading through the issue queue Display Suite is not fully supported by Drupal Commerce and it is not clear if Layout Builder is supported either.

For the non-developers who want to work with Drupal Commerce, which of the UI display management modules are supported by Drupal Commerce?


texts:
I want to add infinite scroll page in search result pages. I am using Drupal 7.

To achieve it i followed this link.

When i do exactly as per the step given on this page, but i am not able to get it working.

Here is the HTML generated on my search result page.

Now to apply the pager in this page i made the following changes in the scripts given in the above link.

Remove .autopager class as i will have to add .pager class
Remove the imagesLoaded function as there are no images in the result

So after removal js will be like this. In his code i have added the .pager class. I am not able to get the pager and what should i write instead of viewsInfiniteScroll

   (function ($) {
  Drupal.behaviors.viewsInfiniteScroll = {
    attach: function (context, settings) {
      $(function(){
        var $container = $('div.pager');
      });
    }
  };
})(jQuery);


texts: Autocomplete Field in View Exposed Filter

texts:
I have created an index Using the Search Api. and integrate with View. And in filter criteria
i have indexed vocabulary. then i want to expose that filter criteria with auto complete field
instead of select list.


texts: How can I show the flag field using Twig?

texts:
I created a twig template for my node.

If I want to show the body field, I use {{ content.field_body }}. Similarly, how can I show the flag field?


texts: How to add Flag Link field to view based on Search Index?

texts:
So, I am building a faceted search view on my product display, but I cannot add the field for the Flag link. I can get fields that reference the User's who used a flag, but no relationship that I can add, allows me to access my flag link as a field.

There are references to this problem Add Flag link to Search Index and Flag Module Integration, but no obvious solution. Thoughts? Recipies?


texts:
I have installed and enabled BBcode, BUEditor, Extensible BBcode and Advanced Forum modules on my site. I would like use BBcodes to post the topics in forum. When I post the topic with any value [for e.g [b]this is a test data[/b]] and submit the posting I see the raw data displayed without BBcode formatting.

Not sure what is going wrong. I see the errors in the drupal logs.

  Warning: preg_match_all(): Compilation failed: unrecognized character
  after (?< at offset 5 in XBBCodeFilter->process() (line 42 of
  /var/web/sites/all/modules/xbbcode/xbbcode.filter.inc).

Appreciate your help.

Thanks


texts: Drupal 7 Syntax Highlighter not applied when logged in as user or admin

texts:
I have a Drupal 7 website.
I installed the syntax highlighter module and downloaded the library.
I was very careful following instructions when configuring the module. I also configured it to get the "insert syntax highlighter button" when using the ckeditor library through the wysiwyg module. Yet, the highlighting is only applied when I preview an article. If I do save that article, the highlighting is gone. Then if I logout, it is applied as an anonymout user. So my question is... Is this normal? I've been trying to fix this for hours but no luck.


texts: How to remove square brackets from name attribute in webform elements?

texts:
Name attribute in rendered webform elements contain square brackets like submitted[field_machine_name].

.

Is there a way to replace square brackets in the name, so the name attribute looks something like "field_machine_name", without breaking the webform submission handler?


texts:
I am on a shared server and someone else has installed Drush previously. But as of now Drush does not work and throws the following error.

[root@vps1]# drush
/root/.composer/vendor/bin/drush: line 47: which: command not found
ERROR: can't find php.

The last thing I can remember was updating PHP (mod_php) to 5.4.36 several days ago. It worked on 5.4.34, but PHP was recompiled during the update. Is this related? What do I need to do to tell drush about this 'new' php?


texts: Why can't I find the parent term of a tag when a node is being inserted?

texts:
I'm following another question I asked, How can I get the parent term in a taxonomy with a hierarchy? and I can get the parent term when I am on the view operation, but not when I'm on the insert operation. var_dump() shows the $terms variable, but NULL for $pterms. Here is my code being called in hook_nodeapi('insert').

  foreach ($node->taxonomy as $term) {
    $terms[] = $term;
  }
  $tid = $terms[0]->tid;
  $parents = taxonomy_get_parents($tid);
  foreach ($parents as $term) {
    $pterms[] = $term;
  }


texts: How do I remove extra divs added by panels?

texts: Panels adds additional classes and divs which are unnecessary for my purpose. How can I remove these?


texts: Modify entity field from preprocess hook

texts:
I can't get how to modify an entity twig variable from a preprocess hook.
It is easy enough to add variables to your twig templates but I don't get how can modify an entity predefined variable.
In my case I want to alter a commerce product to display only one variation.
But when I dump my variable in twig and compare it to &$vars in the hook preprocess I don't see how they fit (if they indeed do ?)


texts: Shopping cart contents section is empty for anonymous users

texts:
there is a problem in my eshop (build with latest D7 and commerce 1.14)  in checkout page where the "Shopping cart contents" section is empty for anonymous users.

I checked the permission "View any type of products" for anonymous users but didn't fix the problem

Any ideas?

Thanks


texts: Create a custom form in Drupal CMS for editors

texts:
I need to create a form for our Drupal Editors. The form must allow them to add records to database.

I see next steps to do:

I add action in place I want.
User clicks on action and modal form appears (that's I do not know how to do in Drupal way).
User submits form and record is added to database.
If possible refresh current page so user can see new record.

Could somebody please point me in the right direction?

So far I'm looking on: CTools Auto-modal and CTools Auto-modal Admin Interface. However I'm not sure if that is right direction.


texts:
I want to change all paths for a given content type.

For example is would change all node of type "image" that are currently at

/[some_token]/[nid]

to

/photo/[nid]

I am using path auto and I have lots of node (70k), what would be the way to go ?


texts: How do you transfer ownership of a Drupal contrib module to someone else?

texts:
I own the S3FS and Date iCal Drupal contrib modules, though I abandoned development on them quite a while ago, due to moving all my work to another platform. However, I am still on the record as the "owner" of these modules, despite there being other maintainers who have taken over.

There's no obvious way to remove myself as owner. I can't uncheck any of my permissions from the Maintainers listing. There doesn't appear to be any UI that lets me designate an existing maintainer as the new owner.

What do I do?


texts: views exposed form alter hook works with login but not work with out login?

texts:
I have created views exposed form for searching title based content and i want to display search results into another page for this i have wrote below code in my custom module,it's working fine with login but can't work with out login please advice.

<?php
function module_name_form_views_exposed_form_alter(&$form, &$form_state, $form_id) {
 drupal_set_message('Form Hook Called');//just to check that hook is called by drupal
  if($form['#id'] == 'form id here')
  {

    $form['#action'] = base_path().'path';
  }
}

Thanks,


texts: {{ directory }} in Twig template in base theme breaks subtheme

texts:
Given a base theme called parent that is a child of stable, and a sub-theme called child whose base theme is parent,  a Twig template implemented in the parent theme renders the wrong value for {{ directory }} variable.

In the parent theme, add a node.html.twig template with the following content:

{# contents of parent/templates/node.html.twig #}
file is themes/custom/parent/templates/content/node.html.twig<br>
directory is: {{ directory }}

Leave node.html.twig unimplemented in child theme, so that it inherits from parent.
Set default theme to child.
Visiting node/1 will print:

file is themes/custom/parent/templates/content/node.html.twig
directory is themes/custom/child

In theory, step 3 should produce a value of themes/custom/parent for the directory variable, otherwise, how can you depend on that variable to reference URLs of additional assets from the parent theme?

In actuality, {{ directory }} is acting exactly like {{ active_theme_path() }}.

As I understand it, this basically means that you cannot use {{ directory }} to reference any static assets in a base or parent theme, such as the path to an image icon, or using the {{ source() }} Twig function to insert an inline SVG.  In my case, I'm trying to do just this:

{{ source(directory ~ '/images/svg/resources.svg') }}

But I get: Twig_Error_Loader: Template "themes/custom/child/images/svg/resources.svg" is not defined.  Obviously, that file only exists in the parent theme.

Possibly this should be filed as a bug on drupal.org but wanted to check here first if this is already known and/or to award some karma points for a successful workaround.

Update:

My current workaround is to implement hook_preprocess() and set a global template variable called parent_theme_path that points to the parent theme path.

// @file parent.theme
/**
 * Prepares global variables for all templates.
 */
function parent_preprocess(&$variables) {
  $handler = \Drupal::service('theme_handler');
  $variables['parent_theme_path'] = $handler->getTheme('parent')->getPath();
}

{# @file parent/templates/node.html.twig #}
{{ source( parent_theme_path ~ 'images/svg/resources.svg') }}


texts:
I am administering a drupal 6 website for a small company. We want to offer our customers restricted streaming video content on the drupal site.

What I heard it is a good idea to place these type of media files on a cdn service, everybody keeps recommending amazon s3 / cloudfront.

Is it possible to have the files on amazon, but have a restricted area on my website, where the user needs to enter some login information and after being authenticated can view the content?

If it is possible, how, what are your recommendations?

I am not familiar with using cdn, so sorry if I ask something very simplistic (:


texts: Referenced entities show old value when changing properties

texts:
I have three custom entities, all generated with Drupal Console. I only added some basicFieldDefinitions to them before testing some CRUD operations on them.

I have these entities:

ConfigEntity (config entity - lowest level)
ChildEntity (content entity - has an entity_reference field to ConfigEntity)
ParentEntity (content entity - has an entity_reference field to ChildEntity)

When I display the name of the ConfigEntity through the entire chain, it displays properly

// "Original Value"
$parentEntity->get('child_entity')->entity->get('config_entity')->entity->label()

When I update the name, it still displays the original value through the chain, although printing it from the entity itself, it is the new value.

// "Original Value"
$parentEntity->get('child_entity')->entity->get('config_entity')->entity->label();

$configEntity = ConfigEntity::load(1);
$configEntity->set('label', "New Value")->save();

$configEntity = ConfigEntity::load(1);

// "New Value"
$configEntity->label();

$parentEntity = ParentEntity::load(1);

// "Original Value" instead of "New Value"
$parentEntity->get('child_entity')->entity->get('config_entity')->entity->label();

Any idea if there's a cache tag mechanism I have to implement manually, or something I have to invalidate myself in code?


texts:
We have a site external to our drupal site, but have to use images from drupal site using absolute URL(No way we upload the same images to that site). So we have to provide them with absolute URLs of the images which will be used by the site.

And it should also be possible that we change the images. i.e., If we have to change the image, we have to replace the existing image with the new image with same name.

What is the best way can this be achieved? Anyhow there is going to be a content in our drupal site that contains the image. Will the image URL be the same ALWAYS when I remove the image and upload another image with same name?


texts:
I see all kinds of examples of how to add a custom validator to an "existing form." Which means, you would use hook_form_alter. I want to add one in the code for my custom form.

I'm adding this in my buildForm():

$form['#validate'][] = 'mycustom_form_validate';

However, that function never seems to get called. I know naming the validation function "validateForm()" would make it work automatically. But I want to specifically call this validation function because things are going to get more complex. But I seem stuck on this baby step.

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

    $form['#attributes']['novalidate'] = 'novalidate';
    $form['#cache']['max-age'] = 0;
    $form['#action'] = '#email_subscription';
    $form['#validate'][] = 'mycustom_form_validate';

    $form['fname'] = [
      '#type' => 'textfield',
      '#title' => $this->t('First Name'),
      '#maxlength' => 255,
      '#size' => 64,
      '#required' => TRUE,
      '#required_error' => 'Please provide your first name.',
    ];

    $form['submit'] = [
      '#type' => 'submit',
      '#value' => $this->t('send'),
    ];

    return $form;
  }

  public function mycustom_form_validate(array &$form, FormStateInterface $form_state) {
    $valid = $this->validateEmail($form, $form_state);
    if (!$valid) {
      $form_state->setErrorByName('email', $this->t('Invalid email address.'));
    }
  }


texts: webform ajax callback response not updating text, is something missing?

texts:
The code below works inside hook_form_alter.  The description and price update from database as desired when in form_alter.  I moved the code to the callback and now it wont return/update the values. I use a button to call the ajax callback. The throbber shows and then no change.
Partial of custom module, using a button for testing the callback

    if ($form_id=='webform_submission_srvform_add_form' && $form_state->isExecuted()) {
        $lkuppage='';
        $lkuppage=$form_state->get('current_page');
    switch ($lkuppage) {
        case 'billing':
            $form['elements']['billing']['items_update'] = [
                '#type' => 'button', '#value' => t('Update prices'),
                '#ajax' => [ 'callback' => 'srvform_items_callback', 'event' => 'click',
                'progress' => [ 'type' => 'throbber', 'message' => t('Updating line items...')] ] ];
            $form['elements']['billing']['desc01']['#prefix'] = '
';
            $form['elements']['billing']['desc01']['#suffix'] = '
';

and the callback

function srvform_items_callback(array &$form, FormStateInterface $form_state) {
    $lkuppart='';
    $lkupok='yes';
    $node_storage = \Drupal::entityTypeManager()->getStorage('node');
    $lkuppart=$form['elements']['billing']['itemflex01']['part01']['#default_value'];
    if (!empty($lkuppart)) {
        $query = \Drupal::entityQuery('node') ->condition('type', 'parts') ->condition('title', $lkuppart);
        $nids = $query->execute();
        $lkupnodes = $node_storage->loadMultiple($nids);
        foreach ($lkupnodes as $nodecnt) {
            $lkuptitle=$nodecnt->title->value;
        }
        if ($lkuptitle <> $lkuppart) {
            $lkupok='false';
        } else {
            $form['elements']['billing']['desc01']['#default_value']=$nodecnt->body->value;
        }
        $lkuptitle='';
    }
    $lkupdesc = $nodecnt->body->value;
    $renderer = \Drupal::service('renderer');
    $response = new AjaxResponse();
    $response->addCommand(new HtmlCommand('#edit-desc01--value', $lkupdesc));
//    $response->addCommand(new \Drupal\Core\Ajax\HtmlCommand('[data-drupal-selector="edit-desc01"]', $lkupdesc));
//    $response->addCommand(new ReplaceCommand('#ajax-desc01', $renderer->render($form['elements']['billing']['desc01'])));
$response->addCommand(new AlertCommand(t($lkupdesc)));
    return $response;

Is it simply a bad/obsolete command I am using?
The AlertCommand works, returns the part description in a window.
Unable to replace the desc01 value with any of the above. syntax? or ?


texts: Splitting existing feature into several smaller. Safe?

texts:
I have this really big feature where all CT, fields, views etc are exported. As far as I understand it makes sense to make it into smaller features, more context specific, like features_views, features_fields, features_CT etc.

The big feature is already enabled in production, is it safe to disable it and enable the other 3? Which approach should I follow?


texts: How can i access variable inside body node(input format:php) from my own module

texts:
please can you help me.

I make own simple module and storing actual variable like this:

.
..
...
function getip_preprocess(&$vars) {
  global $get_specific_ip;
  $vars['get_specific_ip'] = get_client_ip();
}
...
..
.

If i call this variable from page.tpl.php, or node.tpl.php., it works.....

But if im trying to get this variable from inside of body content area, result is empty... If i call function get_client_ip(), i will get solution i need to see, but im trying to get it as a variable, like $user.

I tried to make global variable from it ( $GLOBALS['get_specific_ip']; ) , but it aint works.

Please help me how to do it.

Thanks a lot for your answer.

Regards Stein


texts: What are the minimum requirements for a custom module to be listed in admin/modules?

texts:
Following the instructions in the documentation for creating a custom module, I created a directory modules/custom/my_module and put a my_module.info.yml with some minimal contents like this:

name: 'My Module'
description: 'Does some stuff'
package: 'Custom'

type: module
core: 8.x

In that documentation page, directly after the section that describes the info.yml file, there's a section called "Debugging .info.yml files" and the first item there is "Module is not listed on admin/modules". I'm assuming that means that after I created the info.yml file in the right place, the module should be listed on admin/modules.

Is that assumption correct, or do I need to get farther along in the process before the module is listed on admin/modules? Is there something I need to run to refresh the list or should Drupal be able to find the module automatically as soon as the info.yml file exists, even though there's nothing else in it yet?


texts: Adding translation files to install profile?

texts:
I am building a Drupal installation profile to make deployment of my site easier, ideally I would like to include the translation files to the install profile as well. But apart from adding the core translation files download to the makefile, is there a way to somehow add the translation files for the modules that are in use and for the custom fields as well?

Ideally I would like to add the needed .po files to the makefile or the profile's .install-file. Any ideas on how to do it?


texts: How can I display author name, picture and signature when viewing a full node in D6?

texts: I'd like to display the name, picture and signature of a node's author at the bottom of each node. The node.tpl.php file that I'm using (supplied by the zen theme) includes variables for the author's name and picture, but not the signature. How can I make that accessible in the template file?


texts: Deleted FAVICON from themes folder is showing up

texts:
I have deleted the favicon.ico from the themes folder.

But its still showing up the same favicon. I totally confused.

Steps I have taken: But nothing works... :-(

Checked whether I am in the right directory.
Cleared browsers cache.
Cleared Drupal Cache.
Use the default shortcut icon is checked. (No custom favicon selected)
favicon is located in the sites/all/themes/theme_name/favicon.ico

Could you guys please advice me is there any other way to check or resolve.

Any help will be thankful and grateful...


texts:
I was searching for a long time, but I wasn't able to find a solution. There's one user (pgus ?) did state that he found a solution, but unfortunately he never shared with community how he did it.

So let's repeat:

I've a banner printing business and I need that customers have to enter length and height of the banner and the the square meters are calculated automatically.
And of course then the end price is "price per sqm" x "calculated square meters".
Should not to be too difficult but I can't figure out how to do this.

Is anyone able to provide a reproducible solution ?

Thanks in advance.

Peter


texts: alphabetize the taxonomy term page without views

texts:
Is it possible to alphabetize the taxonomy page without using views?

for example:

THE TERM'S NAME
- A node
- B node
- C node
- D node

Thanks.

CLARIFICATION: I know I can reset the terms themselves to alphabetical, but that does not reset how the node teasers on the taxonomy term page are displayed (these remain in the order they where created). Resetting the display of teasers is what I am trying to achieve.


texts: How can I copy theme configuration when copying a site?

texts:
I have written a script that copies a drupal 8 site. The steps go something like this:

dump old site database into file
replace old site name with new site name in said file
create a new database using that file
Copy all files from the old directory into the new directory
Modify sites.php and settings.php to contain the new site's configuration.

This works (I've debugged the script quite a bit) except for theme settings are not transferred over. Are the theme settings stored in the database? If so, why are my settings not transferred over? If not, where are they stored?

Assuming access only from a command line, how can my script copy theme settings from one Drupal 8 installation to another using the same theme?


texts:
I have created a custom page to view a node type "Post" on my website, and I would like to add threaded comments to these posts.

Comments are enabled for this node type, and I've added several Comment Forms to the page (so that you can reply to a specific comment).

When the forms are created, I DPM the Form Render Array, and I can see that the PID for the Comment Entity has been properly set.

However, when I submit this form, the PID for the Form is totally different.

Could this be caused by having more than one form on the page? I've tried to locate where the PID is changed, but it appears that it is changed right as the form is submitted.

Please advise!!!


texts: Force Creation of New Node With hook_feeds_presave Rather Than Node Update

texts:
I want to have very specific control over the node update process for Feeds. Using hook_feeds_presave() I can stop a node from being updated with $entity->feeds_item->skip = TRUE; but how can I force a new node to be created.

If a node would otherwise update an existing node I want it to create a new node.

This is for Drupal 7.

Thanks!


texts: Allow a user to manage his/her own users and be able to assign roles

texts:
I need to give access to a specific user with a specific role to be able to give the user role but not the administrator

My case is that the website I'm building needs different kinds of admins and roles, for the role I need to find a solution is for a sub-admin this person should be able to add users and assign roles and I also want this person to only be able to manage the users he adds not all the users.

I found that by using flags and roles might be the best way I found this answer to the question "Give a specific user role the ability to give a user a role but not the 'administrator' role". My problem is that I'm not proficient in Drupal and I'm not sure what to add in this window https://pasteboard.co/H7E7rX9.png I'm trying to learn more about rules seeing that probably I'll be using more of this on my project

Thank you so much for your help.


texts: Apache Solr form alter add custom fields in search form

texts:
I wanted to alter the apache solr search form by adding my own custom textfields, dropdowns. I tried using the regular form alter hook but it works only for the Core search i.e custom fields appear for core search. On the Apache Solr form these form elements are not getting rendered.

Is there a way to achieve this kind of functionality ? Or any other Apache solr hook perhaps.


texts: How do customize the HTML output around a specific field using field.tpl

texts:
I in the middle of creating a content type with multiple fields. All the fields need to have all the extra markup removed, except for a specific 3 and I would like these to actually be wrapped in
 tags.

I've copied the field.tpl file into my theme and renamed to be used just for this specific content type, which is working fine with this code:

  <?php if (!$label_hidden): ?>
  <div class="field-label"<?php print $title_attributes; ?>><?php print $label ?>

  <?php endif; ?>

  <?php foreach ($items as $delta => $item): ?>
  <?php print render($item); ?>    <?php endforeach; ?>

My trouble is that I have no idea the syntax I need to target a specific field. So I'm im guessing once I figure out how to target the specific field, I can just use:

  <?php foreach (something here to find the right field): ?>

<?php print render($item); ?></h2    <?php endforeach; ?>

What would that be if my field name was field_sizing_title?

I found the Field Wrappers Module, but it seem like overkill and I really like to learn more about how to work with the field.tpl file


texts:
I push all my local changes to the Pantheon git repository, then I update core via the pantheon dashboard. Now I pull from the Pantheon repository with "git pull git://github.com/pantheon-systems/drops-7.git master"
I am assuming that both versions are identical now, however, when I run git status I get a message that my branch is ahead of origin/master.

Can somebody explain this to me and how I get the local and repository in synch?


texts: Install a distro from an online repository core make file

texts:
I would like to use the hosting tool Aegir to install this distribution from a make file directly:

http://cgit.drupalcode.org/elmsmedia/plain/drupal-org.make

what is the "workaround" to be able to insert the above URL as a string in Aegir platform make file field here:

I have tried a lot of distributions but all failed.

thanks


texts: Conditional fields module, "OR"-like operator

texts:
Can conditional fields module, or another module like it, make a field hidden/shown using an "OR"-like operator? For example,

if field A = 'yes' OR field B = 'no', then show field C.

Right now the conditional field module treats everything as an "AND" operator. For example, if field A = 'yes' AND field B = 'no', then show field C. I want field C to show up on either one of those conditions, not both.


texts:
I'm trying to set up the content types for a site and ran into a bit of a problem.
Let's say I have a content type called Employee, and a list of taxonomy terms that holds function names.
Each employee is linked to a function so to say using a Term Reference to one of the available function. Like this each employee is either a mananger, a desk employee, or a janitor etc.

In a second content type, I wish to add a node reference to these Employee nodes, but I wish to have the option of only selecting the nodes linked to a certain term, such as manager. As such, when creating a new node of this second content type I should only be able to select managers in my overview.

Is there any way of filtering your available options like this? I saw some other questions mentioning the References module, but these questions didn't have an answer.

I hope someone can shed some light on this for me.


texts: How can I do a multi-level sort in Views?

texts:
I have a table format view with multiple columns/fields:

Date
Title
Room

And data that looks like this table (as an example):

|    Date       |    Title      |  Room  |

| 4 June 2016   | Yellow-Green  | Apple  |

| 4 June 2016   | Sky Blue      | Orange |

| 1 June 2016   | Magenta       | Apple  |

| 4 June 2016   | Yellow-Green  | Grape  |

I want to sort the data in the table at multiple levels:

First by Date in descending order
Second by Title in ascending order
Third by Room in ascending order

So from the data given, the table would sort in this order:

|    Date       |    Title      |  Room  |

| 4 June 2016   | Sky Blue      | Orange |

| 4 June 2016   | Yellow-Green  | Apple  |

| 4 June 2016   | Yellow-Green  | Grape  |

| 1 June 2016   | Magenta       | Apple  |

Please note that the data all still needs to be in a single table, rather than splitting into multiple tables, thank you.

The effect I'm trying to achieve in how it's like in Excel -- wherein you can sort the cells by levels -- for instance, first sort by Column B, then sort by Column D, etc.

How can I achieve this in Drupal 7 views without writing/editing any code?

Thanks very much in advance for any help.

(I've edited this question to hopefully clear things up.)


texts: How can I deploy user interface translation?

texts:
Strings that I translate at "User interface translation" /admin/config/regional/translate are not exportable by "Configuration management" /admin/config/development/configuration for me. Am I missing something?

I would like to automate this process with hook_update_N or drush cim -y.

What is a proper way to automatically deploy "User interface translation" in Drupal 8?

Should I do it in hook_update_N()?
Should I create some custom mytranslations.po file in the language folder?

I see there is locale_translate_batch_import_files() which might be used.


texts: Using the built in summary feature when using ONLY paragraphs module for text

texts:
I want to have more flexibility in creating content as usual. Therefore, I use the Paragraphs module, and I also disabled the standard body text. So now, a user can now freely decide how he wants to mix images, text and other content (like embedded videos). For example, an article could now start with a text followed by a full size image, or with 2 half size images followed by a full size video and then the text and so on.

So far so good. Now the problem is that I loose the standard summary function since the default body text is just disabled. This is especially a problem for any list of articles, i.e. the front page.

I have managed to kinda solve this problem by a custom preprocess hook:

function MY_THEME_preprocess_node(array &$variables) {

  $node  = \Drupal\node\Entity\Node::load($variables['node']->id());

  if ($node->field_paragraph && !empty($node->field_paragraph->getValue())) {

    foreach ($node->field_paragraph->getValue() as $key => $value) {
      $paragraph = FALSE;
      if (!empty($value['entity'])) {
        // Use that, we're probably previewing.
        $paragraph = $value['entity'];
      } elseif (!empty($value['target_id'])) {
        $paragraph = Paragraph::load($value['target_id']);
      }

      if (!empty($paragraph) && $paragraph instanceof Paragraph) {

        $summary = $paragraph->getSummary();

        if ($summary && $paragraph->type->getValue()[0]["target_id"] === "text") {
          $variables['summary'] = $summary;
          break;
        }
      }
    }
  }
}

What this does is to loop over all paragraph entries (if any) in a given node and stop iterating at the first occurence of a paragraph type named "text", if there is also a result for the getSummary() function, i.e. this paragraph item also contains some text. Keep in mind that I am far from being a Drupal expert, so this code might not be the optimal way?

However, I cannot seem to control the length of the summary, also any headlines defined in the same paragraph are included as well. Last but not least, the result also contains unneeded markup, so in my node--article--teaser.html.twig twig template I have to strip out those tags again:

<p>{{ summary|striptags }}</p>

The next problem arises when I want to use that summary for the description meta tags on any given article page (so in this case, NOT the pages that contain only lists of articles). Usually I would just use the Metatags module and use this for the description: [node:summary]

Of course that does not work here, and I can imagine that further down the road I will encounter more problems like this.

Therefore, it seems to me that the cleanest way would be to kinda emulate [node:summary], i.e. that this value is automatically calculated by something similar to the function I used above. So for the consumer of this value this would look identical as if the page / node had an actual "default" summary.

Now, is this possible at all, and if "yes" how can I achieve this? Any insights are greatly appreciated!


texts: How do I render a field on a node twice with two different field formatters?

texts:
Is it possible to render a field on a node twice with different field formatters?

I have a content type with the a field type "Email". This field needs to give me as output:

A link to the default email form ("Email contact form")
The original input in the field ("Default email link")

I have put the field formats in quotes above.

Does anyone have a clue on how to do this, or if this is even possible?


texts: Profile pictures not displaying in forum

texts:
I am making my first forum using Drupal and have very little web development experience.  My forum is very basic so far, mostly using core modules.

I tried adding a profile picture for my admin account (and also a picture for a test user account), but the image doesn't show anywhere.  I only get the thumbnail that indicates a missing file or broken link.  I have tried reloading the page, clearing the cache, and installing the profile2 module, but of course I still do not see images.  I have since uninstalled profile2 just because I want to keep the forum as simple as possible until I learn more.

I'm working in version 7.39 and the site is hosted on my university account.

Thanks in advance for any suggestions.

Eric


texts: How to create a Rule to email referenced authors after saving new content?

texts:
I am trying to create a review platform. I have multiple content types, and I have created review content types which are referenced to these content types.

I want to create an action (tell me if you think there is a better way) which would send an email to the original content author to notify them that a review has been published about their content.

Any ideas how to do this or if it's possible?


texts: Ordered Item getting removed & total is incorrect when using \Drupal\commerce_order\OrderRefreshInterface::refresh

texts:
As an alternate solution to this issue https://www.drupal.org/project/commerce/issues/3019615, I tried the following EventSubscriber.
<?php

namespace Drupal\my_module\EventSubscriber;

use Drupal\commerce_order\Event\OrderEvent;
use Drupal\commerce_order\OrderRefreshInterface;
use Drupal\Core\Routing\AdminContext;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
 * The OrderEventSubscriber for updating the total when the order is updated.
 */
class OrderEventSubscriber implements EventSubscriberInterface {

  /**
   * The Admin Context to determine whether the route is an admin one.
   *
   * @var \Drupal\Core\Routing\AdminContext
   */
  protected $adminContext;

  /**
   * The order refresh.
   *
   * @var \Drupal\commerce_order\OrderRefreshInterface
   */
  protected $orderRefresh;

  /**
   * Constructs a new OrderEventSubscriber object.
   *
   * @param \Drupal\Core\Routing\AdminContext $admin_context
   *   The Admin Context to determine whether the route is an admin one.
   * @param \Drupal\commerce_order\OrderRefreshInterface $order_refresh
   *   The order refresh process.
   */
  public function __construct(AdminContext $admin_context, OrderRefreshInterface $order_refresh) {
    $this->adminContext = $admin_context;
    $this->orderRefresh = $order_refresh;
  }

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events = [
      'commerce_order.commerce_order.update' => 'updateOrder',
    ];
    return $events;
  }

  /**
   * Force repack/rates recalculation when quantity is updated.
   *
   * @param \Drupal\commerce_order\Event\OrderEvent $order_event
   *   Order event.
   */
  public function updateOrder(OrderEvent $order_event) {
    if ($this->adminContext->isAdminRoute()) {
      /** @var \Drupal\commerce_order\Entity\Order $order */
      $order = $order_event->getOrder();
      $this->orderRefresh->refresh($order);
      $order->recalculateTotalPrice();
    }
  }

}

When the order is placed:

After the order is updated, the discount figure of 10% is correct but the total amount is incorrect and also the ordered item which was updated is now not shown on the Order View tab:


texts: Redirection should not lose the URL parameters

texts:
I have a rule and in condition I'm checking a path that if the current path is some path then in action I'm redirecting it to new url.

But the problem is that url has some parameters but in redirection it loses the parameters.

For example I have the following url:

first-url?param1=value1&param2=value2

and I want to redirect it to another url. But the url parameters should be append to the new url.

Is it possible in rules?


texts:
I have a project where i want to have a monthly subscription model using the payment module from contrib.

I have spent a couple of hours trying to read their docu (both on d.org and the txt file included for developers) but I cannot seem to make sense of this...

Basically I want to create a payment (in code) that issues a payment for a fixed fee, once per month, using the payment method of my preference.

This is what I have so far

$payment = new Payment(array(
'context_data' => array( // Add whatever you want in this array, this is passed to the payment method. If your are using Paypal Payment method, these informations are also POSTed to Paypal
  'nid' => '1',
),
'currency_code' => 'EUR',
'description' => t('Product description'),
'finish_callback' => '_mycheckoutmodule_payment_complete', // The function providing the page where the user is redirected after the payment
));

$payment->setLineItem(new PaymentLineItem(array(
  'amount' => 50,
  'name' => t('Product name'),
  'description' => t('Site subscription'),
  'tax_rate' => '0.20',
  'quantity' => 1,
)));

$payment->execute();

I want to have a reference (node?) of every payment, or does payment create entities by default after every transaction?

Any help / tips or examples would be greatly appreciated.
Is it just me or is this module very poorly documented?

Thanks in advance!