texts: I had Drush 6 working correctly. I had been using Drush 7 on Mac working correctly but now I installed Drush 7 on Windows. Now when I download modules using drush like drush dl Panels, it downloads the module in a zip format shows the message "Project Panels contains 0 modules." and hence I can't enable them until I unzip them manually.


texts: Approach to adapting a traditional PHP solution into a Drupal module

texts:
I find that traditional PHP development strategies don't help a great deal when trying to mould Drupal into areas it isn't directly built for and I'm hoping for assistance in how I might approach Drupal module development starting with a traditional approach.

I specifically have a project where I know pretty much how I would tackle it in PHP but am a babe in the woods trying to get this to work in Drupal.

I have new tables that I'm adding to the database that reference the 'user' and 'node' Drupal tables. The data used in the site from these tables will have some fairly complex SQL joins etc.

I will be needing a block or two; some summary pages; various admin pages; and permissions and access control for different items.

I've generated my rough wireframes but now I need to get this working in Drupal!

My traditional approach would be to create a class file for the data handling and then build pages or classes to handle the various views and controllers. Template files would be used for individual pages/blocks.

With this in mind what is the best approach to make this work in Drupal - or do I really need to think differently?

For my development environment I'm using PhpEd and running DrupalForFirebug in Firefox. I also use the Devel module and Themer where I need to. Building themes in Drupal is not a big issue for me but modules are something I've avoided.

Thanks :)


texts: Problems accessing Drupal 6 menu_router URL paths

texts:
This week I started to support an existing Drupal 6.19 website with an Ubercart store and some other original content. I have tried for two days now to set up and enable modules such as core's update, contrib devel and a couple of the ubercart extra modules with limited success. Through a node running PHP debugging code, I have been able to check that the various permissions are indeed set and that some of the functions in each module can be called successfully.

However, none of the expected menu router entries are appearing. As a result, none of the URLs defined in hook_menu() functions of each of these modules are accessible. They all return 'Page Not Found'.

There has to be something wrong with the {menu_router} table contents, but I am at a loss on how to further debug this problem.  I have manually and via code cleared the menu cache as well as called menu_rebuild(). However, there has been no visible progress.

Do you have any idea or suggestion on how to resolve this, or how to further proceed in debugging this vexing issue?


texts: What would be the correct twig naming convention to override a table specific to a view page

texts:
can someone tell me the naming convention for a table in a specific page view please

I have views.view--custom-page.html.twig to over ride the page

I assumed it would be views-view-table--custom-page.html.twig for the table but that doesn't seem to over ride it and I can't find the correct naming convention for this.

Thanks


texts:
I'm trying to get run some code if the content type of the current page is equal to events. I am using Drupal 8.

However, I'm unable to write the if statement.

I've tried:

if ($node->type == 'events'){...}
if (Node::getType == 'events'){...}

I also saw this question, but I have no idea how to apply it.

Full code:

// Add og:event:start_date meta tag

function MY_THEME_preprocess_html(&$variables) {
  if ($node->getType() == 'events'){
    $time = [
      '#tag' => 'meta',
      '#attributes' => [
        'http-equiv' => 'og:event:start_date',
        'content' =>  $node->field_next_time->value,
      ],
    ];

    $variables['page']['#attached']['html_head'][] = [$time, 'og:event:start_date'];
  }

}


texts: Control Comment permissions based on OG Roles

texts:
Using OG 7.x-2.7, we have an OG role called contributor that we'd like to use as the decision point to allow or not to allow content contribution in that group.

Of the Group Content nodes, how do I allow the OG contributor role to comment and at the same time allow other group members to see comments but not add comments themselves?

What I've tried so far

Commment OG but I could not get this module to work. I structured the OG permissions as below, but was still about to comment as only a user with the Member role.


texts: How to enable inline editing on Views in Drupal 8?

texts:
It is said to enable the core module "Quick Edit" to be able to easily edit nodes, but there still isn't an easy way to add inline editing in Views. All I want is for text fields to show as inputs which I can change, and then press edit at the bottom. Exactly what is currently achieved with "editablefields" for Drupal 7.

Is there a way to do this in Drupal 8?

Note: Basically my question is the same as this, but for Drupal 8.


texts: Attaching a system js library using #attached property (D7)

texts:
When defining a form using the form api I can attach my own css and js like this:

$form['#attached']['css'] = array(
    drupal_get_path('module', 'my_module') . '/my_css_file.css',
);
$form['#attached']['js'] = array(
    drupal_get_path('module', 'my_module') . '/my_js_file.js',
);

This page on Drupal.org suggests that we can attach system libraries the same way and gives this example:

$form['#attached']['library'][] = array('system', 'jquery.cookie');

However when I add this line to my form:

$form['#attached']['library'][] = array('ui.droppable');

Then the library does not get added.

If I go with the old method of:

drupal_add_library('system', 'ui.droppable');

Then is does get added.

What am I doing wrong?


texts: "Manage Display" for taxonomy term does not allow management of the name field

texts:
There is a taxonomy with an image associated. It is supposed to display with the image and no title. However, in going to the "Manage Display" section for this taxonomy, the name field is not displayed at all.

Searching for this has proven futile. I can manually remove it by modifying display code but then that leaves no way to change its display from the CMS.

Why is the name not manageable as part of the display?
Is there some way to manage the taxonomy term display including the name?


texts: How to submit multiple patches to a contrib module?

texts:
I'm building a web application and use some contrib modules. I heavily rely on a particular module, for which I already submitted a patch a couple of months ago, which was eventually committed.

On these days I had some new requirements, so I added a new functionality to the module and discovered and solved two (unrelated) bugs.

Now a stupid doubt grips me and I'm stuck. My question is: what should I do now?

Create three issues (or write in the existing ones, if the bug was already known) and submit right away my code in three different patches (which are independently written on the current dev version). This means that when a patch will be committed, I'll have to create a new version of the remaining patches for the new dev version
Create a issue with patch for one of the bugs/features, wait that it gets committed, open another issue for another one of the bugs/features, submit a patch on the updated dev version, wait that it gets committed, then open the third issue, submit the patch for the last bug/feature on the again updated dev version. This could potentially take weeks or months.

Usually I would say 1, but due to the short timeframe between patches (a couple of minutes, just the time to create the issues) and the fact that only one person is the creator of all of them, gives me the impression of spamming. It's not a problem for me to create and "maintain" three issues and the related patches, I jut want to do it in the right way.


texts: 'path' in array with special characters using imagecache

texts:
I have a folder in my sites/default/files directory filled with product jpg's gathered from an external server and back end stock take system.

The files look like this...

Bread.jpg
Bakery.jpg
Cakes+and+Puddings.jpg
Chocolate+Bars.jpg
Chocolates+%26+Treats.jpg
Christmas+Fruit+%26+Veg.jpg

I am using theme_image_style in a custom block template to print the images using an image style from Drupal 7's core image handler like so...

<?php
    print theme_image_style(
        array(
            'style_name' => 'category_header',
            'path' => 'product_group_images/' . $productcategoryurl . '.jpg',
            'attributes' => array(
            'class' => 'category-header-image'
                 ),
            'width' => NULL,
            'height' => NULL,
        )
    );

?>

Where $productcategoryurl is the image name inside the product_group_images folder.

This all works great where the image is only one word, like bread.jpg or bakery.jpg

The trouble I am having is the "+" or "&" (%26) in the image names.

I have tried str_replace to swap the spaces in the product name with "+", but in the path, the "+" is always encoded, and the image is never saved in the new style.

So my path comes out like....

/sites/default/files/product_group_images/Chocolate%2BBars.jpg

Instead of...

/sites/default/files/product_group_images/Chocolate+Bars.jpg

And therefore, no image is created in the /sites/all/files/styles directory.

Is there a way using the "path" in the array to actually use the "+" as a space without encoding it?

I hope ive explained that well enough, its late!


texts: Rotor banner, Toggle the display of an image banner and rotor banner view based on view results

texts:
Within the page node is a field for an image that is the page's banner image. We also use Rotor banner to do rotating banner images in the same location. Since I have a default banner set for the page, pages can't have an empty banner field. If a rotor banner view exists, both the page's banner and the rotor banner display stacked on top of each other.

How can I test to see if the rotor banner view has any results and determine whether or not the field banner for the page should display or not? If there is a rotor banner to display, I want to hide or remove the field banner from display.

Both the field banner and rotor banner are living as blocks in the same region. I would like to come up with something for the "Page specific visibility settings" for the blocks, but I'm thinking I will have to do it some how within the theme.

I can't figure out how to see what nodes have been loaded other than using Firebug. If I could access those nodes in a variable accessible to the block or the theme, I could detect if there are rotor items loaded.

Does anyone have any ideas?


texts: Views data export only exporting for current page

texts: I have a view which show Tabular data and i have attached data export on this view which should export in CSV format. The problem is if the data is paginated exportation is only downloading the records on the current page, but I want all records. Is there a way of making it to ignore the pagination.


texts: What's wrong with my plupload implementation?

texts:
For reasons that are out of scope here I should not send packets over 32 MB, so my php.ini looks like this:

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 500M

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20

; Maximum size of POST data that PHP will accept.
; Its value may be 0 to disable the limit. It is ignored if POST data reading
; is disabled through enable_post_data_reading.
; http://php.net/post-max-size
post_max_size = 32M

I know plupload can do this, so I "only" needed to integrate it with Drupal. For this I installed Plupload integration module. Thanks to Clive I found this bug report:

  Right now you need to spesify a max file size larger than the max post size as plupload is stil honoring the setting.

I'm not particularly happy with upload_max_filesize = 500M but I guess for now I can live and work with it.

I tried custom code first:

  'DownloadFile' => array(
    //'#type' => 'managed_file',
    '#type' => 'plupload',
    '#title' => t("Download"),
    '#title_display' => 'invisible',

    '#upload_validators' => array(
      'file_validate_extensions' => array(),
      'file_validate_size' => array(variable_get('my_max_file_size', 300 * 1024 * 1024)),
    ),
    '#upload_location' => 'public://mymodule/download',
    '#default_value' => $item->fid,
    '#required' => TRUE,
    '#plupload_settings' => array(
      'runtimes' => 'html5',
      'chunk_size' => '10mb',
    ),
  ),

It was showing 300MB under the Form API field all right. Sadly, everything over 20MB gave me:

  Error: File too large: Some_182MB_file.zip

So I thought I'm doing something wrong and decided to try ready-made solution. I went for FileField Sources Plupload - I see 32 MB on the node add form, but 182 MB file uploaded all right.

So what's wrong with my implementation? I practically copied example from official documentation so I would expect it to work.


texts: Limit entity reference field formatter to certain entity types

texts:
I've created an entity reference field formatter. It works fine. However, the field formatter will only work properly on entities of type user, so if the referenced entity type is different, I don't want the formatter to appear in the list of options.

I tried adding entity_types = { user } to my annotation for the formatter, but this didn't work. I'm suspecting it cannot even be done, but I thought I'd ask here before opening up an issue in core, to suggest it for future development.

Does anyone know if this can be done, and if it can, how?


texts:
I am unable to get tokens to display in a  message I have created. I am looking to resend an order confirmation email.

I am using message_notify.

Standard tokens like site:name work fine but when I try commerce-order tokens the string is output not the token value

This is the callback function I have so far:

// Resend confirmation email
function commerce_cc_resend_confirmation_email($order){

 $variables = array(
    '@test' => 'this is a test',
    '@replace' => 'fsdfdsfdsf'
  );

  $message = message_create('commerce_resend_order_confirmation_email', $variables);
  $wrapper = entity_metadata_wrapper('message', $message);

  message_notify_send_message($message, $variables);

  $output = "An order confirmation email has been sent. " ;

  return $output;

}


texts: Migrate urls from Category/?EntityID=nodeid to Category/nodeid

texts:
i am migrating the articles from an old site that has url's in the
example.com/Economy/?EntityID=000018c5-8ded-4518-8690-4985cf051a4c format to drupal.

I have managed to get the Economy [field_category] part and the 000018c5-8ded-4518-8690-4985cf051a4c [article_id] into fields for each article,
so i want to make a redirect from the old
[field_category]/?EntityID=[article_id] url scheme to a drupal friendly
[field_category]/[article_id]

I have tried creating aliases with Pathauto, but it does not work because the ? and the = are replaced with %3F and %3D

What is the best way to do that?

Regards


texts: Views Slideshow block not working properly when I add any Sort Criteria

texts:
From the fields I added the NID, image, title, body. When I replaced the body with a custom text area field from content type there was a problem:

From the 5 pictures that are in the view, only 1 or 2 show up, others do not show up or simply ignores them and go back to the first image in the slideshow. The problem exists only if I set any Sort Criteria, otherwise everything is working properly.

I cleared the cache, run cron, but without success, the problem still exists.

I forgot to mention, when there is no image, no other fields also.


texts: Print just field data from a view into a block?

texts:
I'm trying to get a variable from a view to display on a block. For example "We have 200 blog posts" (200 being the variable).
Right now I'm using the views_embed_view method. The problem is the view includes a bunch of mark up I don't need/want (the container, theme, etc)

Is it possible to just call the field I want? I know I could create a whole custom theme for the view without markup but I'm hoping there is an easier way.


texts: Render drupal field widget in custom page

texts:
Possible Duplicate:
  Is displaying a working Field Widget Form on its own possible?

I have my module called mymodule.

In mymodule.module I have:

function mymodule_menu() {
    $items['mymodule/ship/%node'] = array(
        'title' => t('Shipment details'),
        'page callback' => '_mymodule_addr',
        'page arguments' => array(2),
        'access callback' => TRUE,
        'type' => MENU_VISIBLE_IN_BREADCRUMB,
        'weight' => 0,
    );
    return $items;
}

I want to render the addressfield widget inside the page. Then I want to read form values.
Can you help me?


texts: Blocks created twice for a single page load

texts:
In a template file I am using this code

$blocks= block_get_blocks_by_region('revel_card_dashboard');

To grab blocks for a region to render at specific parts of the template. This is causing the regions to be created twice.

Checking stack traces the first time the blocks are created is by drupal core.

 2 =>
  array (
    'file' => 'C:\\xampp\\htdocs\\revel\\html\\includes\\module.inc',
    'line' => 799,
    'function' => 'call_user_func_array',
  ),
  3 =>
  array (
    'file' => 'C:\\xampp\\htdocs\\revel\\html\\modules\\block\\block.module',
    'line' => 854,
    'function' => 'module_invoke',
  ),
  4 =>
  array (
    'file' => 'C:\\xampp\\htdocs\\revel\\html\\modules\\block\\block.module',
    'line' => 674,
    'function' => '_block_render_blocks',
  ),
  5 =>
  array (
    'file' => 'C:\\xampp\\htdocs\\revel\\html\\modules\\block\\block.module',
    'line' => 318,
    'function' => 'block_list',
  ),
  6 =>
  array (
    'file' => 'C:\\xampp\\htdocs\\revel\\html\\modules\\block\\block.module',
    'line' => 268,
    'function' => 'block_get_blocks_by_region',
  ),
  7 =>
  array (
    'file' => 'C:\\xampp\\htdocs\\revel\\html\\includes\\common.inc',
    'line' => 5616,
    'function' => 'block_page_build',
  ),
  8 =>
  array (
    'file' => 'C:\\xampp\\htdocs\\revel\\html\\includes\\common.inc',
    'line' => 2583,
    'function' => 'drupal_render_page',
  ),
  9 =>
  array (
    'file' => 'C:\\xampp\\htdocs\\revel\\html\\includes\\common.inc',
    'line' => 2471,
    'function' => 'drupal_deliver_html_page',
  ),
  10 =>
  array (
    'file' => 'C:\\xampp\\htdocs\\revel\\html\\includes\\menu.inc',
    'line' => 531,
    'function' => 'drupal_deliver_page',
  ),
  11 =>
  array (
    'file' => 'C:\\xampp\\htdocs\\revel\\html\\index.php',
    'line' => 21,
    'function' => 'menu_execute_active_handler',

How can I grab the already created blocks instead of creating them a second time as the call up top seems to do?

Clarification: I do not want to simply cache the block because its important to update the block when the user revisits the page, but there is no point in updating it with time expensive methods twice a page view.


texts: How can I create a custom view other than content types?

texts:
How can I create a view that's based on a custom table from a custom module.

Actually in creating views path I can see options of view types as:

  View type:

  Node: Nodes are a Drupal site's primary content.

  Comment: Comments are responses to node content.

  File: Files maintained by Drupal and various modules.

  Node revision: Node revisions are a history of changes to nodes.

  Term: Taxonomy terms are attached to nodes.

  User: Users who have created accounts on your site.

But when selecting the node option I can only select from node table and selecting user I can select from the user table for displaying the data from these tables. But if I need to display data from the custom tables how can I select that table on creating the query and display them on the view pages?


texts: `Drupal\DrupalExtension` extension file or class could not be located

texts:
I got this error upon launching behat tests:

  [Behat\Testwork\ServiceContainer\Exception\ExtensionInitializationException]
  Drupal\DrupalExtension extension file or class could not be located.

Does any additional module is required?
Found https://www.drupal.org/project/behat but for d7


texts:
I have a block that is displaying related content to the node being viewed. Currently it's displaying node titles for three content types : hotel, tour operator and transport.
I would like it to display only content type that is similar to the content of the node currently viewed and filter out the two other content types.

I have been trying to set this up using contextual filers in views but I can't get it to work.

Is it something that can be done using contextual filters without writing any code ? Or do I need to write some php (I can't) to get this to do what I need.

Thanks


texts:
I am trying to create a table in views. My main problem is that I want to have a image in the label

       "CONTENT"

so far I've managed to add a space to the field and a custom class to it, and I've added background image to that field. It works but is not the best implementation. Can you point me in the right direction or it can not be done?

Thank you and keep up the good work. (i'm new to drupal but I know php css html javascript, mainly I've made small sites with custom cms and I'm moving go drupal)


texts: I want to allow users to copy YouTube URLs to a field in a node form, then have the node display a slideshow of those fields. Is this possible? I looked at the media front and ddblock  modules, but those draw from multiple nodes and not multiple fields in a single node.


texts: How to add placeholders in customized module?

texts:
I am new to drupal, currently I am creating a new module for forms. Inside of module I have added the code as follows .

$form['first name'] = array(
    '#type' => 'textfield',
    '#title' => t('First Name'),
    );

In this case I wanted to use place holders for text fields. So how can I do ?


texts: How can I hide Delete option from Operations in Admin - Drupal 7

texts:
I have a user with a role with restricted permissions. The content type is restricted to "Edit" only. However, the Operations Select box still displays Delete.

Well, as I can check several checkboxes of different kind of content, that is correct. But the problem is that the user can continue to the next screen, where she is asked if she wants to delete the item. IMHO, this message should never display, because the user has no deletion permissions, so it is quite confusing.

Can I override this screen in a simple way, so it will not listed those nodes which have no deletion permission?


texts: How do I access the "#default_value" property from $form_state['values']

texts:
I am trying to get the "#default_value" property of a form element that is embedded in a fieldset.

The problem is that in my code I know the element name only, but I do not know the element fieldset in which it resides. Is there a mechanism to fetch that out without having to search up and down the $form array to find in which fieldset my element resides, and then getting it using $form['someFieldset']['myElement']['#default_value']?


texts:
mydomain.com currently points to public_html/. I want to use .htaccess to direct it to public_html/live/mysite.com/ . How can I do this?

I believe I need to add a directory to one of these lines (line 102-105 of .htaccess):

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]


texts: How can I filter a View by the value (or data) of field?

texts:
This seams like quite a basic thing but I cannot work out how to do this in Views, since the Views filter criteria has no option to use the data/value from a specific field or token. There is only an option to add a constant value or to expose the field, neither of which are useful in my case.

I have a list of entities which I would like to filter based on the value of a node field; and this value is auto assigned through a default token set in the content type. The field is a plain text field with a date in it, which I would like to use to filter my list of entities to only show the entities created on that particular date.


texts: How can I force a user to submit webform before viewing certain pages?

texts: I have a client who wants a webform to pop up when a user views a search result page. They want to user to submit their contact info in order to view the results, but only once in case they search multiple times.


texts:
I'm using the Drupal 7 method db_insert, to insert data into a custom table in the Drupal database. I've read that this is the prefered way, however I've walked through the code and doco and I can't see anywhere which parses the values, or tells me that these values are safe.

Some of the values are coming from the user so I need to check against SQL Injection attacks.

This is the example I was reading, where the Drupal 6 parses the values, and the drupal 7 version does not.

<?php
// Drupal 6 version
db_query('INSERT INTO {vchess_games}
   (gid, timestamps, white, black, state, board_white, board_black) ' . "VALUES ('%s', '%s', '%s', '%s', '%s', '%s', '%s')",
   $gid, $timestamps, $game['white'], $game['black'], $state, $board_white, $board_black);

// Drupal 7 version
db_insert('vchess_games')
  ->fields(array(
    'gid' => $gid,
    'timestamps' => $timestamps,
    'white' => $game['white'],
    'black' => $game['black'],
    'state' => $state,
    'board_white' => $board_white,
    'board_black' => $board_black
  ))
  ->execute();
?>


texts: Change workbench moderation state with VBO does not work properly

texts:
I have two workbench moderation states draft and publihsed
When I try to change the state of a node from draft to published using VBO's set moderation state action, It actually republish the published revision. While it should publish the draft revision.

In the screenshot, it move the draft to published with revision 4 and that should be the published revision. But it is pointing to the revision 3 that this is the published revision.
Is there any workaround for this issue?
Any hint where to look?


texts: Session values are getting populated only when the page is refreshed

texts:
I have a webform. I provide default values to these webform using session token variables. These session variables are set using hook_form_alter(). The problem is that when users log in, and see the form, it is not populated. When they refresh the form, only the values get populated.

How can I solve this issue?

/** updates **/

I have custom module like

webform_options_form_alter(&$form, &$form_state, $form_id){
//here i set some values for session variables like.
$_SESSION['name']  = 'pradeep';
}

so in webform default value i put like %session['name']. This takes the value when page is refreshed.

I have the login form as block on the same page of the webform. As soon as the user logs in the webform should be filled with user data. This is not happening. When he refreshes the page after login only he sees his data.


texts: Drush 8 not working correctly on (LAMP) Ubuntu 16.04

texts:
I am running LAMP on Ubuntu 16.04.  I have a drupal 7 installation and I have installed drush 8.1.3 via Composer version 1.5.2. I believe there is bug in php7.2 causing the error as discussed on Github, however even after I applied the recommended fix which is to update the pear/console_table to the latest version instructed here, the problem still remains. I also followed the instructions on Super User to be absolutely sure that I have the most up to date version of pear installed as well (did not install PHPunit).  And, FYI in accordance with the drush installation documentation found here, I also made the proper changes to my .bashrc file as well (below).

Whenever I run drush status I receive the following error:

[UPDATE: This part of problem SOLVED by @GiorgosK answer below.  Other problems persist due to Drush not find mysql socket]

count(): Parameter must be an array or an object that implements     [warning]
Countable Table.php:789
count(): Parameter must be an array or an object that implements     [warning]
Countable Table.php:789
count(): Parameter must be an array or an object that implements     [warning]
Countable Table.php:789
count(): Parameter must be an array or an object that implements     [warning]
Countable Table.php:789
count(): Parameter must be an array or an object that implements     [warning]
Countable Table.php:789
count(): Parameter must be an array or an object that implements     [warning]
Countable Table.php:789
count(): Parameter must be an array or an object that implements     [warning]
Countable Table.php:789
count(): Parameter must be an array or an object that implements     [warning]
Countable Table.php:789
PHP executable         :  /usr/bin/php
PHP configuration      :  /etc/php/7.2/cli/php.ini
PHP OS                 :  Linux
Drush script           :  /home/webdevusr/vendor/drush/drush/drush.php
Drush version          :  8.1.13
Drush temp directory   :  /tmp
Drush configuration    :
Drush alias files      :

If I execute drush sql-connect

Unable to load class Drush\Sql\Sql                                  [error]
Drush\Sql\SqlException: Unable to find a matching SQL Class. Drush   [error]
cannot find your database connection details. in
/home/webdevusr/vendor/drush/drush/commands/sql/sql.drush.inc:541
Stack trace:
#0
/home/webdevusr/vendor/drush/drush/commands/sql/sql.drush.inc(221):
drush_sql_get_class()
#1 /home/webdevusr/vendor/drush/drush/includes/command.inc(422):
drush_sql_connect()
#2 /home/webdevusr/vendor/drush/drush/includes/command.inc(231):
_drush_invoke_hooks(Array, Array)
#3 /home/webdevusr/vendor/drush/drush/includes/command.inc(199):
drush_command()
#4
/home/webdevusr/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67):
drush_dispatch(Array)
#5 /home/webdevusr/vendor/drush/drush/includes/preflight.inc(66):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#6 /home/webdevusr/vendor/drush/drush/drush.php(12): drush_main()
#7 {main}

The contents of my ~/.bashrc file, are as follows:

export PATH="$HOME/.composer/vendor/bin:$PATH"

export PATH=/bin:/usr/local/bin:/usr/local/mysql/bin:$PATH

# Include Drush bash customizations.
if [ -f "/home/webdevusr/.drush/drush.bashrc" ] ; then
source /home/webdevusr/.drush/drush.bashrc
fi

# Include Drush completion.

if [ -f "/home/webdevusr/.drush/drush.complete.sh" ] ; then
source /home/webdevusr/.drush/drush.complete.sh
fi

# Include Drush prompt customizations.

if [ -f "/home/webdevusr/.drush/drush.prompt.sh" ] ; then
source /home/webdevusr/.drush/drush.prompt.sh
fi

The result of drush cc all executed from within my drupal installation folder is:

No Drupal site found, only 'drush' cache was cleared.

Anyone know how to get drush to working for my local (LAMP) Drupal 7 installations?

thx


texts: Fixed time per questions in quiz modules

texts:
I'm new to Drupal, and I'm developing a site in Drupal 6. It's an online exam related site. I want to add quiz questions that have their own time; each question will have its individual time, and the total time of the quiz will be the total sum of the single question's times.

Is this possible in Drupal 6 with one of the quiz modules?


texts: How do I use Hook_update_N to update an FieldConfigStorage?

texts:
function some_config_update_8101(){

if ( !FieldConfig::load('image_byline') ){
    $config_path = drupal_get_path('module', 'some_config') . '/config/install/field.field.node.main_image.field_image_byline.yml';
    $data = Yaml::parse($config_path);
    \Drupal::configFactory()->getEditable('field.field.node.main_image.field_image_byline')->setData($data)->save(TRUE);
    $message .= "FieldConfig installed for module some_config.\n";
  }
  else {
    $message .= "It didn't work!\n";
  }

     if( !FieldConfigStorage::load('image_byline') ){
        $config_path = drupal_get_path('module', 'some_config') . '/config/install/field.storage.node.field_image_byline.yml';
        $data = Yaml::parse($config_path);
        \Drupal::configFactory()->getEditable('field.storage.node.field_image_byline')->setData($data)->save(TRUE);
        $message .= "FieldConfigStorage installed for module some_config.\n";
     }
     else{
       $message .= "That didn't work either!\n";
    }

Above is the code I am attempting to use to update a content type with a new field on my site.  When I run the dbup command I get "PHP Fatal error:  Using $this when not in object context in EntityStoageBase.php.

How is my code affecting the context of EntityStorageBase, if I have not changed code in that file?


texts: Accessing text field with multiple values in a twig file

texts:
Here is my use case: I have a content type which has a field referencing multiple other entities. Those entities have a text field with multiple values.
So I do
{% for ref in node.field_references %}

and then inside the loop
ref.entity.title.value

To have the title of the referenced entity. This works. Then I try to list the values in the text field:
for value in ref.entity.field_name_of_text_field

But without success. Is there something else that must be done first?


texts: How can I display search filters in a view?

texts:
I'm working on a site in drupal 8 that uses commerce 2. I'm learning as I go with this and feel like I'm missing something on how everything fits together.

I made a view for products, and configured how products display, and used twig templates to add wrappers and classes etc. This seems to work fine, but when it comes to adding any functionality, Twig doesn't seem to be the place to do it. The config options in Drupal cover layouts and CSS classes but are very complex.

This is confusing when you need to make the markup a certain way. In my case I need to add the following in a horizontal row:

number of results found
Select dropdown to filter results by a taxonomy
Another select for different taxonomy
Free text search box

I need to then style these also so I'd really want to control the markup generated, to some degree. How would I go about implementing this in a view?


texts:
Some years ago I made a Drupal 7 site. I want to remake the site with Drupal 9.
In Drupal 7 I added nodes programmatically with this PHP code.
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

$data = $_GET['d'];

AddNewNode($data);

function AddNewNode($data) {
  list($installlanguage, $playerid) = explode('|', $data);
  $node = new stdClass();
  $node->type = 'new_install';
  node_object_prepare($node);
  $node->language = LANGUAGE_NONE;
  $node->field_hm_new_installlanguage[$node->language][0]['value'] =   $installlanguage;
  $node->field_hm_new_install_playerid[$node->language][0]['value'] = $playerid;
  node_save($node);
}

The code doesn't work in Drupal 9.
I tried to search Google for drupal 9 add content programmatically, but I don't seem to get any useful result. Most links are about Drupal 8.
I also tried the following code, but I get this error.

Fatal error: Uncaught Error: Class "Drupal\node\Entity\Node" not found

use \Drupal\node\Entity\Node;

$data = $_GET['d'];
AddNewGameInstall($data);

function AddNewGameInstall($data) {
  $node = Node::create([
    'type' => 'new_game_install',
    'language' => LANGUAGE_NONE,
    'field_device_language' => $devicelanguage,
    'field_player_id' => $playerid
  ]);
  $node->save();
}

Can someone point me in the right direction?


texts:
I have a table products structure like this

product_id   product_name   product_created_date   product_expiry_date  availability
----------   ------------   -------------------    -------------------  ------------
    1           x             12-NOV-13                14-JUN-14               No
    2           y             13-DEC-13                   null                Yes
    3           z             14-DEC-14                14-DEC-15              Yes
    1           p             12-NOV-13                14-JUN-14              Yes
    ----        --             -----                     ----               ----

I need a query like :

select product_id from products where (product_expiry_date>='12-DEC-14' or product_expiry_date is null) and availability='Yes'

how to do this using EntityFieldQuery?


texts: How can I remove an entry from the blog front page?

texts:
If you enable the Blog core module in D7, you have a multiuser blog. It will produce a blog front page for all blog entries published at the path /blog.  It is just like the ordinary front page <front>, but only show nodes of type "blog".  By default, all published blog nodes appear on the blog front page.

For the site's default front page there is checkbox "Promoted to front page" under "Publishing options". Unchecking that prevents the node from appearing on the default front page.

Adding a similar checkbox field named "Promoted to blog front page" to the "blog" content type will of course do nothing by itself.

I want to use this field to control whether a blog node appear on blog front page, but have not found a "hook" or a "preprocess-function" or similar Drupal-thing that let me do so with the view of blog teasers that the core blog module produces.

I know I can do this by replacing the blog core module with my own, using Views to produce the list of teasers for the blog front page.

But in this question, I am looking for a way to do this with the view produced by the core blog module?

Is this possible, or must I use Views if I want this?


texts: Hide some part of node when the field_countdown timer is zero

texts:
I create a field with field_countdown. Now I want hide some part of my node text when the timer is zero.

For this when I use this code:

{% set a = 'now'|date("U") %}
{% set b = node.field_timer.value|date("U") %}
{% if a < b %}
    Show
{% else %}
    Hide
{% endif %}

Work but not currectly. And in first page send me an error.

  The website encountered an unexpected error. Please try again later.
  TypeError: DateTime::__construct() expects parameter 1 to be string,
  array given in DateTime->__construct() (line 519 of
  vendor\twig\twig\lib\Twig\Extension\Core.php).

In second way I create a field like my field_timer and just show secondes and after my timer show zero IF command work but in this way I add a field and it's not good.

How can I do this with other codes in Drupal 8 ?


texts:
I'm using webform_multiple_file. To display my submissions, I created a view and added as field Webform submission data: Value

To customize my view I used print $fields['value_1']->content ;

This displays somthing like this:

  image1.png

  image2.jpeg

But I want to display just the first data and as an image like

Below the HTML return

image1.png

image2.jpeg

Any idea please? Thank you


texts: How can I link a text field to a user profile such that I can display nodes on the user profile based on that text field

texts:
I'm trying to create a relationship from thin air, at least that's how it feels.

I have two account roles.  Producers and Instructors.  I want to be able to reference nodes (events) created by Producers on the related instructors profile page and vice versa.  The caveat is that the 'referenced' accounts may not yet exist.

For example:

Producer A creates an event and lists Instructor B (who has an acct and profile) and C (who does not have an account) as the instructors via a multivalue text field (reference field is not possible here).
Once the node is saved, the system checks for a relationship between the text field data and user profiles.  A relationship exists for Instructor B, so the nodes are displayed on her profile.  No relationship exists for instructor C yet, so nothing happens.
instructor C comes a long and makes an account, when the account is saved the system checks for relationship again and finds a relatioship between previous nodes and this new account, the nodes are displayed on the profile.

I am thinking this field could be an email address or something.
Is this possible and does anyone have advice on where to get started?


texts: Maintenance Mode Screen Does Not Display

texts: I'm using Drupal 8 with a purchased theme. I'm not 100% tech literate so apologies in advance if my question sounds dumb. After Drupal and the theme were initially installed I had no problems. After enabling maintenance mode and logging out the maintenance mode page displayed. Now, however, after logging back in, disabling maintenance mode and logging out, the original theme page does not display, and a Log in page displays. Repeating logging in/logging out, enabling/disabling maintenance mode only the Log in page displays, no maintenance mode page or original theme page. I've cleared the cache in Drupal and in my Chrome browser but it makes no difference.


texts: Need help for Drupal 7 Ajax Add more form elements

texts:
$form['feedbackmarkup']['feedback']['num_domains'] = array(
    '#type' => 'hidden',
    '#default_value' => 1,
);
       $num = isset($form_state['values']['num_domains']) ? $form_state['values']['num_domains'] : 1;
     for($i = 1; $i <= $num; $i++){
    $form['feedbackmarkup']['feedback']['fname_'.$i] = array(
        '#type' => 'textfield',
        '#size' => 12,
        '#required' => true,
        '#prefix' => '
',
        '#suffix' => '	',
    );
    }
       $form['add_more'] = array(
        '#type' => 'button',
        '#value' => t('Add More'),
        '#href' => '',
        '#ajax' => array(
           'callback' => 'for($i = 1; $i <= $num; $i++){
    $form['feedbackmarkup']['feedback']['fname_'.$i] = array(
        '#type' => 'textfield',
        '#size' => 12,
        '#required' => true,
        '#prefix' => '
',
        '#suffix' => '	',
    );',
           'wrapper' => 'feedback_replace',
         ),
       );

and In my Ajax callback function

  function ajax_example_simplest_callback($form, $form_state) {
         $test = isset($form_state['values']['num_domains']) ? $form_state['values']['num_domains']+1 : 1;
        $form['feedbackmarkup']['feedback']['num_domains']['#value'] = $test;
       drupal_set_message(print_r($form_state['values'],true)); //It is printing form_state with values but not adding my fields above in for loop
        return $form['feedbackmarkup']['feedback'];
}


texts: Remove 'Your Name' field from comments display

texts:
I want to hide/remove the "Your Name" field from the comments on a Drupal 7 site.

I am using the bamboo theme and Drupal 7.

I have seen a few threads for the but most are about removing the subject line, or are about Drupal 6 etc. I have tried a few different methods I have seen, but have not succeeded in getting this to work on Drupal 7 as of yet. Any advice?


texts: Views: Modify filter/argument when no results occur

texts:
I currently have a "store locator" proximity search setup very similar to the one detailed here: http://www.youtube.com/watch?v=AxeskzN8BAc.

The user enters a postcode, and receives results or no results as the case may be, for a given rectangular distance (say 100km around the entered postcode). Both postcode and distance are exposed filters.

If a node/marker isn't within the zone, I get no results. How can I dynamically modify or widen the distance so there are always some results? ie. How can I hook onto the exposed filter arguments and re-run the view for the no-results case?


texts: How can I extract info from the user_profile array

texts:
So I know that the $user_profile is basically an array. And when I use the DSM command with devel I saw all that info in the array, but how on earth do I begin extracting and displaying data from that?

I'm still not too keen on php, trying to learn as I go and on the side. I understand the concepts of an array and how to get top level stuff. But for those items embedded in other arrays embedded in yet more arrays, I'm not sure how to get to those and display them.

For a simple instance I just want to take the username of the profile currently being views and display it on a custom user-profile.tpl page. And I see it with devel, but I don't know how to get it.


texts: Mixing node content with custom PHP code

texts:
I got a "normal" node that contains some simple text content like this:

This is how our internship program work .....

After that text I want to include a list of our current team members. I can reuse existing PHP code for that. It gets the data from taxonomy.
I am new to Drupal, so I don't know a lot about it yet. But I can call that PHP code with a hook like this
function my_custom_menu() {
  $items['internship'] = array(
    'type' => MENU_CALLBACK,
    'title' => 'Internship',
    'access arguments' => array('access content'),
    'page callback' => 'my_custom_page_internship',
  );
  ...
  return $items;
}

But how can I combine both: the node and PHP code to show it as one?


texts: Javascript aggregation issue with new server

texts:
I have a new VPS Host and have cloned my existing live site from my current VPS Host. On the new host, there is an issue with JS aggregation and I am hoping someone might recognize what this is and how to solve it.

Generally with JS aggregation set at /admin/config/development/performance, Javascript breaks sitewide, both front end and backend, logged in and non-logged in. I checked permissions and the JS directiory at /sites/default/files/js/ and it seems fine, files are writing to this directory (both the JS files and the GZipped ones).

When I view the raw code of any of these files, the code is fine (not corrupt). I have also tried switching this off, clearing cache, switching back on, clearing browser cache and even deleting the directory which Drupal did and then recreated without any issue. I checked my PHP info file (5.2.17) and it shows this under PHP Variables _SERVER["HTTP_ACCEPT_ENCODING"] - gzip,deflate,sdch so that seems ok. However my old server's PHP info file also had gzip,deflate,sdch under an additional heading called "HTTP Headers Information".

But here is the real tell-tale, I think, when I view the code of my webpage with Chrome web inspector and look in Console, I see as many JS errors as there are aggregated files. (5 or 6 I think). The error is: Uncaught SyntaxError: Unexpected token ILLEGAL If I then view the corresponding JS file, I see this:

So somehow, the aggregated JS files are turning into gibberish characters and the errors are thrown. I have spoken with my webhost and we tried some things but nothing worked. They had me put this code into .htaccess but it did not work:

[root@host ~]# httpd -L | grep deflate
DeflateFilterNote (mod_deflate.c)
DeflateWindowSize (mod_deflate.c)
DeflateBufferSize (mod_deflate.c)
DeflateMemLevel (mod_deflate.c)
DeflateCompressionLevel (mod_deflate.c)

Also I was not exactly sure where in .htaccess to put it. (under <IfModule mod_headers.c> perhaps?) At any rate this did nothing to help matters no matter where I tried that code. I feel like this is a bit of a needle in a haystack and might be tricky to fix but I am curious if anyone recognizes what might be going on so i can fix it.

** I should also note that litespeed Server is running on top of this so not sure if there are nay issues with that. I have not looked into this yet.


texts: Render field by name in custom content node template

texts:
I'm trying to create a custom node template in drupal 8.

I've added the content type and am displaying them in the Front Page view.

I would like to render each field in the in the the node template (node--content-type.html.twig).

Using the recommended {{ content.field_name }} syntax, causes the node to print nothing except the title.

Are there any prerequisites to using this syntax, what am I missing here?


texts: Ckeditor fake linebreaks with pasted text

texts:
Problem

When you paste text into ckeditor it creates line breaks in the display which don't appear in the actual text.

How can I either paste in text and have it create actual linebreaks, or paste in text and not show the fake linebreaks?

Example

In order to create an actual line break you have to press delete and then add two returns in order to create a genuine linebreak (I have CKEditor configured to create
 on enter).

Sample Text I Used: Taken from Dolor Ipsum Website

(Shown in HTML Full Text format)

bibendum feugiat tortor a imperdiet. Ut nisl lorem, bibendum iaculis est quis,    mollis convallis neque. Vestibulum vitae erat vitae sem tempus consequat.

Integer a auctor lorem, sit amet sagittis lectus. Sed bibendum at purus eu mollis. Sed pretium tincidunt nulla vitae fringilla. Etiam ac fringilla nulla. Cras lectus magna, suscipit sed felis accumsan, sagittis lobortis justo. Vestibulum volutpat auctor mi, at&nbsp;


texts: How do I update the CKEditor text widget using CKEditor API

texts:
I am using Drupal 8's Ajax API to update form fields in a form depending on the input in another field. One of the fields I want to update is a text_format field that uses Drupal's ckeditor.

If I understand the CKEditor API correctly, I should be able to update the text in the ckeditor widget using the setData() method (https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_editor.html#method-setData). The ckeditor instance should be the textarea id - and that I can easily identify in my AjaxResponse function.

However, I am not sure how to use Drupal's invokeCommand() to make use of the CKEditor API?


texts: Search api & solr search => no results found

texts:
Configuration: I am using Drupal 7, search api and search api solr.

Description & problem: I am trying to use search api and solr search(as a back end) to search for nodes. I have a solr server running in localhost:8983/solr/admin/. I create a solr server inside drupal configuration, then I create a node index using this server and I index the field: title. The index runs successfully and indexes my 11 articles.

Then i create a search page using search_api_page to test out the searching functionality. Result: I get "Your search yielded no results" when searching for a word in the title of the articles (the word exists in the titles)

I am starting to become desperate here. The index is working correctly but neither through a search page nor through a view can I access the results. It says there are none :O Any ideas?

EDIT: I can query by hand, if i go to localhost:8983/solr/select/?q=spell:test then I get all the articles with the word "test" in their title. Also a ?q= will show all the indexed articles


texts:
I really need help with this.

I want to replace the link within the tab tile with an image. I can't find a solution for that. I saw some patches but I am not good at php and I did't got them right.

Can someone please tell me where I can find some tutorials about that?

Thanks.

I want to give some update regarding this. I tried different solutions and I need some advice.

Main goal is to add a different image to each tab. Empty tabs will be hidden.

Version 1. Field-Group module

I tried using that module and simple css with both class and id tab:

#vertical-tabs-list1 {
background: url('images/harta3.png');
background-repeat: no-repeat;
height: 64px;
text-indent: -9999px;
padding-top: 15px;
}

.vertical-tab-button.vertical-tab-button2 {
background: url('images/evenimente.png');
background-repeat: no-repeat;
height: 64px;
text-indent: -9999px;
padding-top: 15px;
}

This is working up to a point where is not working properly. If you hide empty tabs the following tab will take class and id of previous tab and that will mess up everything, because class and id are in li element and not in a href element like quicktabs.

Version 2. Quicktabs - Plausible solution

Contact

As you can see we have this id="quicktabs-tab-pagina_local-0" in

what I tried is simple css for each tab

#quicktabs-tab-pagina_local-0 {
background: url('images/media.png');
background-repeat: no-repeat;
width: 100px;
height: 100px;
font-size: 0px;
}

This option seams to work, even if we have hidden empty tabs.

Now I want to ask:

Is version 2 reliable, or I will mess up things in other places?
Is it possible to add id same way to field group? How?

Thanks


texts: I made a custom view mode in Display Suite and I would like to use it as the default view mode for a given content type. Can anybody enlighten me as to how to do it?


texts: How can i reload jQuery scripts after form submit in views using ajax?

texts:
I have a views with ajax enabled using B.E.F. to filter some content. After submitting these filters jquery scripts stop working.
Please help me to find an answer how to reload any of these scripts after using submit button with ajax?
I`ve tried to do something like this and load it as a simple script using drupal_add_js in template.php:

Drupal.Behaviors.reload = function (context) {
jQuery(".form-submit").submit(function() {
  jQuery("table").stickyTableHeaders();
});
}

I know that this code can hardly work but still firebug says Drupal.Behaviors is undefined.


texts: Fatal Error while sending a multipart POST request to a image upload created using Field API

texts:
While testing a site i created using "Acunetix" web vulnerability scanner, it posted a multipart request to a  image upload field created using Field API.

The test manipulated a POST statement and got an error message back.

POST (multipart) input organisation_image[und][0][height] was set to 198.

Error message found: Fatal error

I cant figure out what is happening. Any ideas how to solve this.


texts: Add placeholder or default value to captcha text field

texts:
There is a webform in my website, I added the captcha to this webform using this code:

function THEME_form_alter(&$form, $form_state, $form_id) {
    if (strstr($form_id, 'webform_client_form')) {
        $form['my_captcha_element'] = array(
                '#type' => 'captcha',
                '#captcha_type' => 'image_captcha/Image',
        );
    }
}

This works fine. I need to insert a placeholder or default the text field of the image. I mean in the following picture :

the What code is in the image? should move inside the text field. How do I can do this?

Even though it is possible to make this done using javscript but I need to make this done using form alter.

Thanks


texts: Accessing location field programmatically in Drupal 7, via hosting entity object and wrapper

texts:
I'm using Location module (particularly its Location CCK part) with Drupal 7. Added location field 'field_location' to User (as an example of hosting entity), and initialized location values for test users in user edit interface. However, I'm unable to access location data of the current user:

global $user;
$user_id = $user->uid;

$loc = $user->field_location;

or:

$wrapper = entity_metadata_wrapper('user', $user_id);
$loc = $wrapper->field_location;

The statements with $loc don't work for object and wrapper (while both user object and wrapper are initialized successfully). Same for:

$loc = $wrapper->field_location[0];
$loc = $wrapper->field_location->raw();

I've read a number of posts on this topic, however haven't found a workable solution, would appreciate insights on this.


texts:
After much package dependency finagling via composer, updating PHP, updating MariaDb, etc.. (not as bad as D7 => D8 but still harder than I'd hoped) I managed to update from 8.9 => 9.0.7.  I was able to run update.php, clear cache, etc. site seemed to be working ok, no errors.  I enabled the core Media module as apparently blazy now depends on it.  Now I'm getting:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘########.media' doesn't exist: SELECT "base_table"."vid" AS "vid", "base_table"."mid" AS "mid" FROM {media} "base_table" GROUP BY base_table.vid, base_table.mid LIMIT 1 OFFSET 0; Array ( ) in Drupal\Core\Entity\EntityStorageBase->hasData() (line 583 of /var/www/sites/#####.test/docroot/core/lib/Drupal/Core/Entity/EntityStorageBase.php).```

If I try to run update php I see:

MISSING UPDATES FOR: MEDIA
The installed version of the Media module is too old to update. Update to a version prior to 9.0.0 first (missing updates: media_post_update_collection_route, media_post_update_storage_handler, media_post_update_enable_standalone_url, media_post_update_add_status_extra_filter).

MISSING UPDATES FOR: MEDIA LIBRARY
The installed version of the Media Library module is too old to update. Update to a version prior to 9.0.0 first (missing updates: media_library_post_update_display_modes, media_library_post_update_table_display, media_library_post_update_add_media_library_image_style, media_library_post_update_add_status_extra_filter, media_library_post_update_add_buttons_to_page_view, media_library_post_update_update_8001_checkbox_classes, media_library_post_update_default_administrative_list_to_table_display, media_library_post_update_add_langcode_filters).

I'd rather not take core back to an earlier version to resolve this as I'd have to also downgrade some modules, namely Solr which was not super easy to configure.
Can anyone suggest how I might go about resolving this?  Is there a way to update a core module without updating core?  I thought of just copying and pasting but obviously that wouldn't resolve my missing table issue.
Any pointers in the right direction would be immensely appreciated.


texts: Is there any way to validate taxonomy terms?

texts:
Is there any way to validate a taxonomy term before it will be saved? I'm using Simple Hierarchical Select with its "add new item" functionality. I would like to enable this option for registered users. They are not completely trusted though. What I would like to do is to create some limit on number of terms that can be added, for example per day. This is a ajax callback of SHS that creates new terms:

function shs_json_term_add($vid, $parent, $term_name) {
  if (!user_access('edit terms in ' . $vid)) {
    // Sorry, but this user may not add a term to this vocabulary.
    return FALSE;
  }

  $term = (object) array(
    'vid' => $vid,
    'parent' => $parent,
    'name' => check_plain(filter_xss($term_name)),
  );
  // Save term.
  $status = taxonomy_term_save($term);

  // Return term object or FALSE (in case of errors).
  return ($status == SAVED_NEW) ? array('tid' => $term->tid, 'name' => $term->name) : FALSE;
}

As you can see, it basically checks permissions and saves term by using taxonomy_term_save($term); . Would there be a way for validating this term without patching SHS module?


texts: How to display multiple fields in one line in drupal

texts: First of all I'm new to Drupal. I want to add 3 form fields inline as shown in the image. So I want to know what is the best method of doing it.


texts: How do I 'programaticaly' create a new content type with hook_install in D7?

texts:
I am trying to create a .INSTALL file which creates a content type (Apples) for my module (Fruit). I have dropped the following file (fruit.install) into my module folder with the .INFO file and .MODULE file. After enabling the Fruit module, I look into the database and find that there is no new entry in the node_type table. I must be missing a vital step? or I have made an obvious mistake, I think?

<?php

/**
 * Implements hook_install()
 */

function fruit_install() {

    // * If the content type does not exist then create it.
    if (!in_array('Apples', node_type_get_names())) {
        $type = array(
            'type' => 'apples',
            'name' => 'Apples',
            'base' => 'node_content',
            'custom' => 1,
            'modified' => 1,
            'locked' => 0,
        );
        $type = node_type_set_defaults($type);
        node_type_save($type);
        // * Set 'Apples' options
        variable_set('node_preview_apples', 0);     // Set 'Preview before submitting' to 'Disabled'
    }
}


texts:
I'm using the Zen sub-theme. I don't want all the new stuff on the site showing on the home page so I'm editing page--front.tpl.php. Removed print render($page['content']). But now I want to add some static text and and image to my home page.

How do I go about doing this basic thing?


texts: How to check validity of one time login url by Drupal 7 Services module?

texts:
I am developing a client side application and using AngularJS for this. I successfully registered a user.

Now my problem is that I cannot find a way to check the validity of one time login url or any end point provided by Services module?

Anybody an idea?


texts:
How do I Display empty fields in Views? Empty_Fields module does not work for me as there needs to be a custom text for it to display.

I want to display all labels even if the fields are empty. How do i achieve this?

Thanks


texts: Uploaded images broken with secure site turned on

texts:
Images I upload through CCK appear broken, the path they are referenced to is blocked with secure site.  When I view the image I am taken to the secure site login page, once I enter my login info I can view the image. But I am already logged in. The strange thing is sometimes one of these uploaded images is visible. Uploaded images have the following url structure.

All permissions are set correctly and only these images are blocked by Secure Site.

/sites/default/files/imagecache/142x142/imagefield_default_images/def_expert_4.png

/sites/default/files/imagecache/142x142/def_expert_4_19.png

sometimes one url works sometimes the other


texts: Passing page arguments to custom block inside panel

texts:
I have created a page(Page Manager) in drupal 8 with a path say /dashboard/{nodeid}. Inside that I have created a Panel and inside panel I have added a Custom Block ( which I created programmatically by extending BlockBase).
Now my problem is I want to use the {nodeid} inside my buildForm function.

Please suggest me.

My code is as follows.

ABCBlock.php

class ABCBlock extends BlockBase
{

    public function build() {

        return \Drupal::formBuilder()->getForm('Drupal\examples\Form\ABCForm');

    }

}

ABCForm.php

class ABCForm extends FormBase
{

    public function getFormId() {
      return 'example_ABCForm';
    }

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

      drupal_set_message('Hello World.'); // displaying fine.
      $tmp = arg(0);//or arg(1) which i am assuming as url parameter value. But it FAILS.

      //load node object using $tmp

    }

}


texts: How do I properly print the $node array in a views row template?

texts:
I'm writing a custom views-view-row-rss--content-type.tpl.php file in Drupal 6.

How do I properly print the $node array?

I have tried print_r($node) and even used node_load(). I'm not sure where to go next.


texts: Flat Rate Base Price set by product entity field

texts:
I have a question that has to do with Drupal Commerce's Flat Rate.  I have been going through the information that I could find about how to solve this but could not find a definite solution and I am not very familiar with rules.

The way I want to set up shipping is like this. I have an entity type (variant) which has 2 fields field_shipping_price ( for a shipping price) and also a field field_shipping_quantity_limit (for quantity limit).  How I need this to work is a site user (with the right permission) can set a custom price for shipping via the field shipping price and set a quantity limit per line item (for that order) within the entity variant.  My question is how could I set this up so that each line item (if multiple line items) can have its own shipping rate which is set by the field_shipping_price and then each individual line items shipping price is totaled and the added to the order.  Plus, it checks and then limits the line items quantity per the field_shipping_quantity_limit.

Thanks for any help or direction you can give with this.


texts: Webform: change the way each component is displayed?

texts:
What I'm trying to achieve: I want to show my webform so each input would be displayed on separate page (kind of wizard or form with steps). I know that usually this is done by adding page breaks at desired position, but I have more than 80 elements and adding page break after each of them is super awful idea.

My plan is the following: create a module that'll override renderers of all elements except fieldset. My renderer will call original renderer and wrap its return value in #type => 'container' element with specific class. On page there'll be a piece of JS that'll show/hide specific fields depending on field state.

But there are no hooks that allow me to override element rendering, overriding it with hook_form_alter looks to be a bad idea: I'll have to recursively walk through passed form. I think there should be a different way.

So how do I override the way element is rendered?

Or am I getting this completely wrong and webform should be replaced with something more appropriate for my task?


texts:
I am using the Zen theme, what I could like to do is effectly add a php include for a header area. This is common code so a block will not really do.

I have html.tpl.php which is added automatically to each page is there anyway to add custom chunks to every page for example myheader.tpl.php


texts:
I have migrated Drupal 7 website to Drupal 8 version using the core migrate_drupal_ui module successfully but the paragraph module was broken upgrade path which results in final that the paragraph bundles not migrated and I have created in the new site like the old.

Now I need to migrate content for the paragraph fields only and update the nodes, I did some research and found possible solutions as follows:

1- Custom migrate plugin But I don't know how to edit existing.

2- custom script to read the nodes from other site by creating feeds and update.

//$nid get from feeds.
$entity = entity_load('node', $nid);

$entity->set('field_audit',
['field_number' => [0 => ['value' => 4]],
'field_regular_materials' => [0 => ['value' => '44']],
'field_verification' => [0 => ['value' => '444']]], FALSE);

$entity->save();

  That code gives error Fatal error: Maximum function nesting level of '256' reached, aborting!

what is the best practice to achieve.


texts: How to create a Privatemsg thread with multiple recipients in a Rules component?

texts:
I'd like to send private messages to a selected group of users. For this purpose I use a view with VBO and a Rules component action (utilizing the "Send message" action provided by Privatemsg) - as  described in this question.

However, I still have a minor issue with it: Since I send the messages looping through the list of users, privatemsg module sends individual messages and doesn't create a thread with multiple users. Is it possible to use the whole array of users in a single "Send message" action?

Probably one solution might be to use cutoms PHP code in rules component and create thred with privatemsg_new_thread function. But it's not a very drupalish way, I guess.


texts: How can I delete nodes when an arbitrary date has past?

texts:
I have a situation where future events will be posted to the website in question. These future events are a content type with a date field using the date module.

I wish to automatically delete these events once their date has past. I'm assuming that rules should do this but I have searched and I am struggling to find a way to do this.


texts:
I am constructing a query that has to fetch the field collection line item, and it's associated field collection field to get the node id that the field collection field is being used on. The problem is it's only ever returning one single result when I know for sure there are at least two to return. Perhaps a fresh set of eyes can help.

Run list field table

"entity_type","bundle","deleted","entity_id","revision_id","language","delta","field_run_list_item_value","field_run_list_item_revision_id"
"node","run_list",0,100000018,48,"und",0,4,12
"node","run_list",0,100000017,47,"und",1,3,11
"node","run_list",0,100000017,47,"und",0,2,10

Run List field's line item table:

"entity_type","bundle","deleted","entity_id","revision_id","language","delta","field_story_target_id"
"field_collection_item","field_run_list_item",0,2,10,"und",0,100000004
"field_collection_item","field_run_list_item",0,3,11,"und",0,100000009
"field_collection_item","field_run_list_item",0,4,12,"und",0,100000004

This is my query:

$rl_query = db_select('field_data_field_story', 'fci');
$rl_query->fields('fci', array('field_story_target_id', 'bundle', 'entity_id'));
$rl_query->leftJoin('field_revision_field_run_list_item', 'rl', 'rl.field_run_list_item_value = fci.entity_id');
$rl_query->fields('rl', array('entity_id', 'field_run_list_item_value'));
$rl_query->condition('fci.field_story_target_id', $node->nid);
$rl_results = $rl_query->execute()->fetchAll;

When I dpm($rl_results); it ends up looking like:

... (Array, 1 element)
    0 (Object) stdClass
       field_story_target_id (String, 9 characters ) 100000004
       bundle (String, 19 characters ) field_run_list_item
       entity_id (String, 1 characters ) 2
       rl_entity_id (String, 9 characters ) 100000017
       field_run_list_item_value (String, 1 characters ) 2

I should expect to see more than one result returned. In this example, there should be two.


texts:
i'm getting a notice

  Error message - Trying to get property of non-object

here's my function:

<?php
function func()
{
        $node = menu_get_object();
        global $user;
        if ($node->type == 'hall' &&
            in_array('instructor', array_values($user->roles)))
        {
            return " hall-instructor ";
        }
}
?>


texts: Allow users to annotate content in Drupal 7

texts:
Is there any way to allow users to add some private annotations when reading a book page for example ?

It seems that the annotate module is not anymore supported.


texts: How do I check whether the patch for SA-CORE-2018-002 is applied?

texts:
How do I check whether the patch for SA-CORE-2018-002 is applied in a Drupal 7 website?

I have applied the patch. How does it secure my Drupal websites?


texts: How to change name of result of rest export?

texts:
I have a custom entity (ContractSubscription) created in a custom module (amap).
One of its fields (contract_id) is a link to another custom entity (Contract) of the same module.

I created a View to export content of ContractSubscription as a csv file using REST Export.
Among the settings of the view, I have:

Path: /amap/contract/export
Contextual filters: 'Contract subscription : Contract' (this allows me to view only the subscriptions related to a specific contract)

When I go to mysite/amap/contract/export/2, I have the expected result that I can save locally:

As far as I understand, the name of the result is defined by the actual path when the view is executed, i.e. '2' which is the end of the path (in fact the value of the contextual filter).

I'd like to have something like 'Contract2.csv' instead of '2'.
How can I do that?


texts:
I add a CSS file (mymovies.css) to a custom form (SeenMovies) in a custom module (eric) with this code I inserted at the end of buildForm
$form['#attached']['library'][] = 'eric/mymovies';

and this code in eric.libraries.yml
mymovies:
  version: 1.x
  css:
    theme:
      css/mymovies.css: {}

But my css doesn't override bootstrap.min.css as you can see in Firefox inspector:

How can I fix that?


texts:
So I did a git clone to get my Drupal 8 site working locally on another PC. This project already has a lot of nodes (articles) with images attached to them.
The site works perfect, but of course I did not push the images to git. So ATM I'm a bit confused as to where I should add these images. Is there a proper way to import these with a module or setting? I'm still learning so could be a simple thing I missed. Thanks in advance


texts: Send email on changing line item field value

texts:
I have a custom list field on the product line item type, which is for the ability to set seperate shipping statuses for each product in one order.

When the store admin updates this list field on a line item, the site will need to send out an email to the customer.

Is there a nice way to make this happen?


texts:
I have problem when our taxonomy term is linked with node but when i am clicking on term they go front page of site instead of current page
our code given below:

$ch1 = db_query("SELECT th.tid FROM taxonomy_term_hierarchy th
  INNER JOIN taxonomy_term_data td ON th.tid=td.tid
  INNER JOIN field_data_field_books book ON book.field_books_tid = th.tid
  WHERE td.vid = '6' AND th.parent = $ch AND book.entity_id = $nid
 ")->FetchField();

$chap1=taxonomy_get_children($ch1);
foreach($chap1 as $ca1){
    $link = l($ca1->name, 'node/' . $ca1->nid)."<br>";
    print $link;
}

How to handle this problem?


texts: Override a single JavaScript file from a module

texts:
In my theme's libraries.yml file, after the global-styling section, i'm trying to replace one JavaScript file from the core Toolbar module (it's addition of padding-top to body interferes with our theme, so just changing that to margin-top).

libraries-override:
  toolbar/toolbar:
    js:
      js/views/BodyVisualView.js: js/views/BodyVisualView.js

I repeatedly get the error:

  Drupal\Core\Asset\Exception\IncompleteLibraryDefinitionException:
  Incomplete library definition for definition 'libraries-override' in
  extension 'mythemename' in
  Drupal\Core\Asset\LibraryDiscoveryParser->buildByExtension() (line 93
  of
  /vagrant/web/core/lib/Drupal/Core/Asset/LibraryDiscoveryParser.php).


texts: ajax_deliver and Advanced Form Blocks issue

texts:
I am new to AJAX framework in drupal 7.

Scenario:

I have two content types (Type-A and Type-B). I am displaying node add form of Type-B on Type-A edit form using Advanced Form Blocks module.
There is another block which lists the nodes of Type-B. I want to refresh that block everytime Type-B node is created. I accomplished it by using the following code in hook_node_insert of my module:

    $commands = array();
    $html = views_embed_view('my-view', 'block_1', $nodeId);
    $commands[] = ajax_command_html('#wrapper', $html);

    $page =  array(
            '#type' => 'ajax',
            '#commands' => $commands,
    );
    ajax_deliver($page);

which works fine but the Advanced Form Block (Type-B node add form) stopped showing the success message and the form is not getting reset which was happening before I implemented the code mentioned above. The nodes are getting saved just fine. I am assuming that somehow ajax_deliver is interrupting the default process that was happening before.

I would really appreciate some help regarding this.

Thanks in advance.


texts: In hook_node_insert drupal_goto with alias name not working

texts:
In hook_node_insert() i have used drupal_goto(), to go to the newly created node with alias name of it, but id doesn't work.

I have already created url alias with patterns for that content type.

$alias = drupal_get_path_alias('node/'.$node->nid);
drupal_goto($alias);

If i give drupal_goto() with nid it works.

drupal_goto('node/'.$node->nid);

What is the issue with respect to alias name not working or how to get alias of newly created node and get it redirected to view page of it with alias name as url.

Any ideas or suggestions? Thanks in advance.

[Updated code]

This is the code which i am trying

function hook_node_insert($node)
{
    if($node->type == 'product')
    {

        $_SESSION['product_node_nid'] = $node->nid;
        $banner = $_SESSION['banner'];
        $theme = $_SESSION['theme'];
        $params = array();
        $params['node'] = $node;
        $site_email = variable_get('site_mail', '');
        if(($banner || $theme) || ($banner && $theme)) {
            drupal_goto('payment-approval');
        }
        else {
            //$alias = drupal_get_path_alias('node/'.$node->nid);
            module_load_include('inc', 'pathauto'); // include the inc file for Pathauto module
            pathauto_create_alias('node', 'insert', 'node/'.$node->nid, array('node' => $node), $node->type, $language->language); // Language is optional
            $alias = drupal_get_path_alias('node/'.$node->nid);
            //$alias = drupal_get_path_alias('node/'.$node->nid); print_r($alias); exit();
            drupal_goto($alias);
        }
    }
}


texts: How do I create a 'page' that creates and downloads a file from within a module

texts:
I have mymodule.php which contains all the logic for my site.

I need to create something like this.

header("Content-type: text/csv");
header("Content-Disposition: attachment; filename=file.csv");
header("Pragma: no-cache");
header("Expires: 0");

$array = array(
    array("data11", "data12", "data13"),
    array("data21", "data22", "data23"),
    array("data31", "data32", "data23"));
outputCSV($array);

function outputCSV($data) {
    $outstream = fopen("php://output", "w");
    function __outputCSV(&$vals, $key, $filehandler) {
        fputcsv($filehandler, $vals); // add parameters if you want
    }
    array_walk($data, "__outputCSV", $outstream);
    fclose($outstream);
}

Generally I've been adding items to mymodule_menu(), mymodule_theme(), and directing it to a mymodule_mypage() function, and oftentimes a mypage.tpl.php.

This setup doesn't really make sense for what I need to do here, though.

I need a linke like mysite.com/mypage to generate/download the csv.

I don't think that headers will work in a mymodule_mypage() function, and the template files are not appropriate because they load headers/footers etc.

I could just create the php files separately and create links to them, but I'm trying to keep things within the module and with tidy URLs.


texts: Executing a Rule on a user(s) selected from a list

texts:
I have created a user reference field on a node which lists (via Views) all the users the node author is related to in some way. If there is a better way to list users on node forms then I'm open to suggestions. In my particular case the field uses the autocomplete widget with the Views list, but a select list widget could also be used.

I would like to be able to execute a Rule on the user that is selected in the autocomplete/list by the node author. At the moment I am using the Button Field to trigger the Rule execution but I'm not sure how to get the Rule to apply to the specific chosen user. Some ideas are flagging the user when they are selected or doing a textual comparison between the autocomplete text and existing usernames. I have also tried the Relation module but still can't figure out how to get the selection recognized in Rules.


texts: Media Title appearing in View when HTML is stripped

texts:
I've run into an issue with media in a view. I have a view using bootstrap grid to display body field content. The view field content being displayed is setup to strip out HTML, but the word "Image" is inserted where a media entity was. Not sure if the word "Image" is a leftover from media or the entity embed module.

example:

Any ideas on how to get rid of this unnecessary word?


texts: How do I direct users to my custom search?

texts:
I'm trying to use hook_search_execute to run a custom search inside my module:

function mymodule_search_execute($keys = NULL, $conditions = NULL) {
    die; // just to see if we get called
    // lots of lines copied from the hook_search_execute doco
    return $results;
}

I can get the default Drupal search form inside my page.tpl.php with:

<?php print render(module_invoke('search', 'block_view', 'search')); ?>

But, when I click the "search" button on that form, my custom search isn't called.

I'm using D7. What's the appropriate way to actually force a search to get results from my custom search function?


texts: How to build an Email Diggest using Rules

texts:
I am building a Website using Drupal 7. This website contains events, event-comments and event-registrations (=Registrations module):

Event

Event Comments
Event Registration

Now I need to inform users by email when:

New events are created
Existing events are changed/updated
Events are deleted
Event Comments where added
Somebody register for an event
Somebody unregistered of an event

I found the Rules module can trigger actions on these events and conditions.

BUT: I need to generate a digest/newletter with the above information once all day or half a day etc. so users don't get too much emails ;-)

Advanced (but optional) features:

If a user un-register from an event don't send him any more updates on this particular event.
Users can set their digest/newsletter interval in their profile. eg. once a day, once an hour, etc.
Maybe other content-types then events will be added to the digest system later.

Questions:

How to I best build such a digest/newletter email using Rules? What additional modules can be integrated to Rules to address this?
Can Rules-Scheduler by of any help for this?
Is there another email-module that can to this out of the box without Rules?


texts: How can I have more than one extra row for a multi value field when generating a form?

texts:
I have a form with a field that is allowed multiple values(infinite).
Drupal allows one extra empty value to be added between each save but I want to increase this to n number of extra empty values.

I tried in a hook_form_alter adding extra empty value to the field array but only the first one will save as with Drupals default behavior.

Can anyone tell me if it's possible to have more empty values available and if so how?
I can not save the form between generating them one by one though.


texts: drupal_http_request() with POST returns a 405 error

texts:
I am trying to call an external API with a POST method which is working fine on Postman, but when trying to implement it in a custom module using drupal_http_request() I am getting a strange error.

  The requested resource does not support http method 'GET'.

This is the extracted cURL command from Postman: curl --location --max-time 2000 --request POST 'https://example.com/api' --header 'Authorization: [token]' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'subject=Lead XXX' --data-urlencode 'firstName=XXX' --data-urlencode 'lastName=XXX' --data-urlencode 'Email=test@test.test' --data-urlencode 'Mobile=XXX' --data-urlencode 'Interest=XXX ' --data-urlencode 'meetingdate=2020-04-20T13:00:00.000'.

This is the code I am using.

$url = 'https://example.com/api';
$data = [
    'subject' => 'XXX',
    'firstName' => 'XXX',
    'lastName' => 'XXX',
    'Email' => 'test@test.test',
    'Mobile' => 'XXXX',
    'Interest' => 'Testing',
    'meetingdate' => '2020-04-20T13:00:00.000',
];
$options = [
    'method' => 'POST',
    'headers' => array(
        'Content-Type' => 'application/x-www-form-urlencoded',
        'Authorization' => [token],
    ),
    'data' => json_encode($data),
];
$request = drupal_http_request($url, $data);

I have the feeling this must be easy, but I couldn't figure out what I'm doing wrong. I search the documentation, searched here with no luck.

Any hit will be appreciated.


texts: Using migrate_lookup process plugin to reference items processed later in the same migration

texts:
I'm trying to import data from custom source through Migrate in Drupal 8. The problem is that I need to process data which have references to each other. This is excerpt from my migration articles:

field_recommended_articles:
    -
      plugin: string_in_array
      key: id
      source: recommended_articles
    -
      plugin: migration_lookup
      migration: articles
      source: id

This seems to lead to recursion, because following error appears with stack trace containing repeating calls to respective migrate-related methods.

PHP Fatal error:  Maximum function nesting level of '2000' reached, aborting! in .../core/lib/Drupal/Core/Database/Statement.php on line 153

How can I solve this?

The recursion was caused by xdebug. Without it, there is a reference value created, but each value references the same content.


texts: Hierarchical taxonomy fileds' values as node path in Drupal 7

texts:
I have a vocabulary with 2 levels of terms. As my term names are usually rather long (e.g. "Institute of Computer Science and Information Technology") I added a field "short_name" to the vocabulary (e.g. "ICSIT"). Now I am working on creating Pathauto term aliases for node paths. I need it like this:

[short_name of term level 1]/[short_name of term level 2]/[node_title]

The problem is that can't find the right token to achieve this behaviour. Is it possible? Any ideas?


texts: Canonical link for multidomain multisite

texts:
I have different domains in a site in Drupal 7, which is multidomain and multilanguage, using modules Domain Access and i18n. I have duplicate content in some URLs accross domains, and I want to avoid Google penalization by following the recommendations of using

<head><link rel="canonical" href="CANONICAL_SOURCE_URL" />

I will use a custom module. For the nature of Drupal 7, I undestand that I can check each node, and using the node->id and database call, to check the domains in which the node is active. Following an order of preferred domains, I will know that URL to set as the canonical.

Is that a good aproach? I have tried module MetaTag with Canonical, but it uses a wildcard approach so it repeats the domain in which I am, so we can have www.example.com/link1 and www.example.us/link1 as canonicals, when only one of them should be used.

How can I override MetaTag with my own link rel tag ?


texts: How can I copy multiple nodes and reset fields belonging to the copies in one operation?

texts:
I want to copy a list of nodes, create one copy of each node, and at the same time, reset the contents of two fields on each new copy node.

I am using Views Bulk Operations to select the nodes, and Replication with Replication UI to make copies of them.

I think I should be able to reset the two fields on my new copy nodes just with Rules, but I've been unable to work out a Rule that actually works, and several widely linked resources that refer to using VBO with Rules seem to have been deleted recently.


texts: "The website encountered an unexpected error. Please try again later." error show on cache clear

texts:
My Drupal 8 site is working fine but when I am clearing the cache then my site display below errors.

    The website encountered an unexpected error. Please try again later.

Please suggest me what is the problem ?  I have checked status report and it shows the error below


texts: How can I debug a Views 2 block argument set via "Provide default argument" and "PHP Code"?

texts:
I am using Views 2.16 on Drupal 6. I have the Content Profile module loaded and the profile has a nodereference field to another content type called Project. I would like to show a list of Projects in a block on the side when viewing the user page. I need to provide a default argument to a view since it is a block.

So the urls look like /user/admin, /user/joe who are related to content profile nodes 1867 and 1952 etc. I have the view showing correctly if I feed it a node id for a user profile as a hard coded value.

Now I want to do some stuff in the default argument code such as user_load(array('name' => arg(1)), content_profile_load($user->uid) and so on but it's not working.

What I have tried:
print_r, var_export('abc', true), dpm($user), watchdog('php-test', 'a string').

None of these methods gave me any debug output. How can I debug the argument code?


texts: Hook that act on a field being inserted or updated?

texts:
I've Created a VBO view to "Modify entity values" .It's working fine. I need to perform an action when particular entity field gets inserted/updated.

So far I've tried hook_field_update,hook_field_storage_write, hook_field_insert, hook_field_presave. None of them are working

Any suggestions?


texts: Webform radio buttons - why would they differ in appearance between two sites on a multi-site installation?

texts:
I have several sites in a multi-site installation, and at least three of them have Webform enabled.  On one site, radio buttons in forms display like this:

0 Choice A
0 Choice B
0 Choice C

That site uses the Garland theme.

One a second site, running on a proprietary theme called Nevia, radio buttons look like this:

0
Choice A

0
Choice B

0
Choice C

Any idea where to start changing the CSS to make the Nevia version behave like in Garland?  I don't know which stylesheet controls this.  Thanks.


texts: how to get weight or delta of current field collection item that is being computed

texts:
Is it possible to get weight(order index) of multi field "field collection".This weight is needed inside computed field which is inside field collection.I tried the following but it returns empty

$wrapper = entity_metadata_wrapper('field_collection_item', $entity);
$instance = field_read_instance('field_collection_item',$wrapper, 'bundle_name');
dpm($instance['widget']['weight']);

Here is the structure

main_content-contains field collection (multi value)
------field collection(s)-contains 1 text field and 1 computed field
------|----item 0
------|-------|-------computed_field <---here how to get weight of field collection item ie 0
------|----item 1
------|-------|-------computed_field <---here how to get weight of field collection item ie 1
------|----item 2
------|-------|-------computed_field
------|----item n
------|-------|-------computed_field


texts: Drupal commerce - what page/function should i call after an off site payment

texts:
I'm creating a module to integrate 'xpay - carta sì' payments inside Drupal commerce.
I don't have any documentation on xpay apart for the module developed for ubercart.
Anyway i managed to code the part where the payment method is added and i succesfully dealt with going from my site to the bank page sending the correct data. I'm stuck with where to go after the payment is completed.
When i send the data to the bank i set some url to call according to the outcome of the transaction

'RESULT_URL' => $site_url.'/cart/xpay/complete',
'NOTIFICATION_URL' => $site_url.'/cart/xpay/server',
'ERROR_URL' => $site_url.'/cart/xpay/error',
'ANNULMENT_URL' => $site_url.'/cart/xpay/error',

I've defined those menu_callbacks, but i'm not sure that Drupal Commerce works like this, maybe i should do something totally different like returning to $site_url.'/checkout/%order_id/payment'

Has anybody of you tackled something similar?


texts: Import/export configuration and translations

texts:
I downloaded the .po file for loading the Italian language and installed it on my local version of Drupal.

Then, I launched the config:export command with drush and I committed the created configuration files

When I imported the configuration on the target machine (via jenkins) I did not find all the translations loaded

In particular, compared to about 7,000 exported translations, I find only 600 imported ones

Why did this happen?


texts: How to add multiple link in single column

texts:
I am new to drupal, and developing module to save car makes. I want to display that make in table format. Up to this i have completed. Now I have column of action where I want to display 2 links edit, delete. But I can display only one link with my current code. can anyone please help me, here is my code

 function manage_make()
 {
   $output=drupal_get_form('make_form');
   $query="SELECT * FROM {make_master}";
   $make_list=db_query($query);
   /*create table */
   $header=array('Make ID','Make Name','Status','Operatios');
   $rows=array();
   /*read data*/
   if($make_list->rowCount() > 0)
   {
       while($data=$make_list->fetchAssoc())
       {
           $rows[]=array(
            array('data'=>$data['make_id']),
            array('data'=>$data['make_name']),
            array('data'=>($data['make_status']==1) ? 'Active':'Block'),
            array('data'=>t('Edit')),
          );
       }
   }
return  theme('table',array('header'=>$header,'rows'=>$rows,"empty"=>t('Sorry, no makes available')));
}


texts: Different blocks on the same page, dependent on source link?

texts:
Is it possible to have a page that shows (e.g.) one of three different blocks, depending on the originating page link? I'm thinking the only way to achieve this would be to use # or something similar at the end of the URL.

Example:

link one: mysite.com/mypage#one
link two: mysite.com/mypage#two
link three: mysite.com/mypage#three

And then create the three blocks, with the visibility settings set appropriately.

Is this a robust solution that would work with URL aliases etc.?

Cheers,
James


texts: What existing module installs software required for running tests (PHPUnit, etc.)?

texts:
Running tests in Drupal 8 requires certain software to run, of course. However, I was surprised to not find a module, up-to-date set of instructions, or other turnkey method of identifying and installing the required software. It seems reasonable to expect the ability to "flip a switch" and enable testing. Instead, I've had to learn from successive error messages what software was required. So, what existing module or other turnkey method already exists to install the software required for testing?

If you try to run tests after a base install of Drupal 8, you get this message: "run-tests.sh requires the PHPUnit testing framework. Please use 'composer install' to ensure that it is present." However, more appears to be required than merely requiring phpunit/phpunit. The minimum list of software required for running tests appears to be:

phpunit/phpunit (version dependent on your PHP version)
symfony/phpunit-bridge
behat/mink-goutte-driver
mikey179/vfsstream
behat/mink-selenium2-driver

If it helps to know my installation, it is: Drupal 8.8.4, PHP 7.2, PHPUnit 6.5.14, and Drush 9.7.2.

I've got to be missing something because this need seems obvious. Is there an existing module (or other turnkey solution) to install the "PHPUnit testing framework" or minimum software to run unit, kernel, and browser tests?


texts:
I've been setting up a newsletter using Simplenews - it works well enough but only for plain text emails.

I've set up and installed MimeMail but when selected as the site-wide default [admin/config/system/mailsystem] no emails are sent through the site at all - contact forms don't deliver a message and test newsletters aren't sent, though they do both cause a positive message to be displayed above the content.

This page [admin/config/services/simplenews/settings] is all set up for HTML emails.

Previously I was able to send HTML emails from this exact site but I'm not sure what I could've changed. Is it server side or is my email blocking them for some reason?


texts: Custom entity's exposed node reference filter

texts:
I have created a custom Entity using drupal generate:entity:content.
This works great overal: I can use it in my code like I want.

One of the table columns of the entity is a node-reference. This works as well.
However I have created an (admin) view in which I list the entities and want to create an exposed filter to filter by the titles (in a selectbox) of the referenced nodes.
I can't find out how to do that.

When I create a view of nodes in which I reference to other nodes I can easily create such an exposed filter by choosing "Referenced .. something". With my custom entity I don't get such a choice.
I think I must do something in my EntityListBuilder or my Entity class itself.

Currently the only reference in code to the NodeReference is the field definition in my Entity which looks like this:

$fields['competitor'] = BaseFieldDefinition::create('entity_reference')
  ->setLabel(t('Competitor'))
  ->setDescription(t('Competitor'))
  ->setSetting('target_type', 'node')
  ->setReadOnly(TRUE);

I mentioned nothing else about this field in either my entity-class, nor in my EntityListBuilder class. So anything missing there?

Can someone help me out?


texts: Why `GROUP BY` in hook_views_query_alter() doesn't work?

texts:
I'm using Views 7.x-3.6 and I tried altering the GROUP BY clause with hook_views_query_alter() as below:

function mymodule_views_query_alter(&$view, &$query) {
    if ($view->name == "view_name"){
      $query->add_groupby('field_name');
      dpm($query);
    }
}

When I look in $query, the groupby clause is correctly enabled but the SQL query is not affected: the GROUP BY clause doesn't appear:

What I eventually did is using a Drupal core hook (hook_query_alter()) and it worked fine: the SQL is now affected.

function mymodule_query_alter(QueryAlterableInterface $query) {
  $view_name = 'view_name';
  if ($query->hasTag('views_' . $view_name)) {
    $query->groupBy('field_name');
  }
}

Any reason why my hook_views_query_alter() doesn't work? I'm wondering if there's a cleaner way to do it and.


texts: Error in translating apostrophe in module Path metatags

texts:
In module Path metatags if I set a text for all languages, a text with an apostrophe, all is fine. But when I translate that text to other language of the web, the apostrophe is shown as &#039 in that new language.

Any idea? Another characters, as accents, are shown fine.


texts:
I plan to list all polls in the most recent order where I need to join my "poll" table with the "node" table and display them with pager. Here is what I do:

$polls_query = db_select('poll', 'p')
              ->extend('PagerDefault')
              ->limit(3);
$polls_query->join('node', 'n', 'n.nid = p.nid')
            ->fields('p', array('nid'))
            ->condition('p.active', 1, '=')
            ->orderBy('n.created', 'DESC');
$result = $polls_query->execute();
foreach ($result AS $poll) {
  $polls[] = array('data' => drupal_render(node_view(node_load($poll->nid), 'teaser')));
}
$content['pager_list'] = array(
  '#theme' => 'item_list',
  '#items' => $polls,
  '#title' => t('Listing Consensus'),
  '#type' => 'ul',
);
$content['pager_pager'] = array('#theme' => 'pager');
return drupal_render($content);

Unfortunately I see a white screen of death and the php error log says "PHP Fatal error:  Call to a member function fields() on a non-object in  .. " and thats the line where I mention after fields. If I dont use join, everything works fine.

If anyone else has had similar problems, please share the solution.


texts: How do I revert the changes made by a specific user?

texts: I want to revert the changes made by a specific admin user in Drupal 6.37. In all the pages that I want to revert, the create new revision box was not selected. Hence, I have no way of finding out the changes.