texts: Add a subquery to SELECT'd columns in a dynamic query

texts:
I have a query I want to run through Drupal 7's DB API as a dynamic query where a subquery needs to be a column of data.

For example:

SELECT a, b, (
  SELECT x, y
    FROM table
    WHERE table.x = 'value') as c
FROM table_2
WHERE table_2.a = 'value_2'

How can I perform this through the Drupal 7's DB API?


texts: Not able to play video after installing video and video.js with ffmpeg

texts:
I have a video content type where I want to show the video to the user. I downloaded video module and video.js for this purpose. I have successfully installed ffmpeg transcoder in apache server

Now I go to admin/config/media/video. Withing players tab I select HTML5 player for mp4 video and video.js to run HTML5 video like below:-

Now I go to Video Content Type and add Video field with Video Upload as its type and save it.The video is successfully converted but after clicking on play button nothing happens.

Need your help to resolve the issue.


texts: Advanced Aggregation: Should I disable core's aggregation?

texts:
I know that AdvAgg's bundler will, by default, disable core's grouping logic, but I'm unclear as to whether core's aggregation should be enabled or disabled (at admin/config/development/performance) for AdvAgg to be able to aggregate files in the first place.

Basically, I can't tell if AdvAgg is actually aggregating things itself (and thus core should probably be disabled under admin/config/development/performance), or if AdvAgg is taking core's aggregated files and only handling the bundling aspect of aggregation, in which case core's aggregation would need to be enabled. I suspect the former is the case, but I can find no explicit information on this.

Can anyone tell me what the general best practice here is?


texts: How do I test for an empty Address webform element?

texts:
Using Drupal 9.1.3 : Webform 6.0.0
How to check for the null value of a Webform Address Composite element
{% if webform_token('[webform_submission:values:**ELEMENT_NAME**]', webform_submission, [], options) **????**%}

I have tried the following without finding the correct statement.
{% if webform_token(...)  is same as(null) %}

{% if webform_token(...) is null %}

{% if webform_token(...) is empty %}

{% if webform_token(...) == '' %}

(...) = ('[webform_submission:values:address]', webform_submission, [], options)

The only output I get from all 4 statements is:
[webform_submission:values:address]


texts: How can I get the parent node of a referenced node?

texts:
I have a node called project which contains field building as a referenced item, I used the the hook on building node insert and, having this building id I need to get project id which this building is assigned to. How can I get the project id (the building's parent).

I have found the hostEntity() used in drupal 7 (As Far As I Know), but it seemed this is not applicable anymore in Drupal 8.

Any help?


texts: Video embed field doesn't honor the autoplay settings

texts: So I have an embedded video field inside of a paragraph and want it to autoplay.  I have set the settings for the field to have it autoplay, but when the iframe is rendered the url has autoplay=0.  Are there other settings I need to enable to get this to work?


texts: How to add a CSS class to an render array?

texts:
In a template file, before print render($content['field_image']); I would like to add a CSS class to the image in the $content['field_image'] render array. How can I do this?
Here is the render array:

Array
(
[#theme] => field
[#weight] => 2
[#title] => Image
[#access] => 1
[#label_display] => hidden
[#view_mode] => full
[#language] => und
[#field_name] => field_image
[#field_type] => image
[#field_translatable] => 1
[#entity_type] => node
[#bundle] => ll_basic_page
[#object] => stdClass Object
[#items] => Array
    (
        [0] => Array
            (
                [fid] => 6777
                [alt] => alt text
                [title] =>
                [uid] => 1
                [filename] => imageFile.jpg
                [uri] => public://imageFile.jpg
                [filemime] => image/jpeg
                [filesize] => 28742
                [status] => 1
                [timestamp] => 1314312382
                [rdf_mapping] => Array
                    (
                    )
            )
    )
[#formatter] => image
[0] => Array
    (
        [#theme] => image_formatter
        [#item] => Array
            (
                [fid] => 6777
                [alt] => alt text
                [title] =>
                [uid] => 1
                [filename] => imageFile.jpg
                [uri] => public://imageFile.jpg
                [filemime] => image/jpeg
                [filesize] => 28742
                [status] => 1
                [timestamp] => 1314312382
                [rdf_mapping] => Array ()
            )
        [#image_style] =>
        [#path] =>
    )
)

And this is the HTML output:

I tried adding a class to $content['field_image']['#attributes']['class'], but that didn't work.
Do you have any idea on how I can achieve what I am trying to do?


texts: field_info_instance returns empty in hook_uninstall

texts:
In a custom module, I'm creating a new field and instance for a custom entity type like this:

function mymodule_install() {
  if (!field_info_field('mymodule_field')) {
    $field = array( .... );
    field_create_field($field);
  }
  if (!field_info_instance('mymodule_entity','mymodule_field', 'bundle1')) {
    $instance = array( .... );
    field_create_instance($instance);
  }
}

function mymodule_uninstall() {
  if ($instance = field_info_instance('mymodule_entity','mymodule_field', 'bundle1')) {
    field_delete_instance($instance);
  }
  if (field_info_field('mymodule_field')) {
    field_delete_field('mymodule_field');
  }
  field_purge_batch(100);
}

...and the field and instance gets created properly. However upon uninstalling the module, only the field tables are being deleted while the field instance is still there in the field_config_instance table still having deleted = 0.

Debugging the uninstall process reveals that field_info_instance (and field_read_instances) is returning NULL...

Anyone knows what I'm doing wrong? I'm on a fresh Drupal 7.23 install...


texts: How to get values of a listtext through Views?

texts:
on one of my content types I have a list (text) field with the following values.

  100|Of essential importance 75|Of major importance 50|Of
  medium importance 25|Of limited importance 00|Of no
  importance 0|Don’t know

Now I created a View for this ContentType.  In the View, I want to display only the keys (e.g. 100, 75, 50) instead of the values (e.g. Of essential importance, Of major importance etc.)

Any help?


texts: Why would a view be displayed differently in different software?

texts:
Using Drupal 7 and the Views PDF module, I have created a PDF output that looks perfect when opened in a browser, but is inconsistent everywhere else: On Chrome, Firefox, and Edge it is displayed exactly as designed; on
Acrobat Reader, it shows only a table background color, the rest is blank, and there is no text; on iPad and Outlook, it displays a blank white screen.

What would cause the PDF to display perfectly in a browser and horribly in everything else?


texts: A Drupalogical question about Slider captions

texts:
Take a Slider module, no matter which one of them. If a Caption is based on a Body field, and There are many images and only one body field, How would you make different captions per every image?...

Thanks,


texts: Why can't I output the style tag in my twig template?

texts:
I'm desperately trying to render a style attribute, inside a paragraph's template. But all of these variations:

{%
  set backgroundUrl = content.field_slider_background|render|naked|replace({' ': '', "\\n": '', "\\r": ''})
%}

,

{%
  set backgroundAttributes = create_attribute()
%}

and even:

and

just return
. Other tags are fine.

Does twig generally strip style tags?! Using the latest D8 version...

Edit: outputting backgroundUrl actually gives me the correct string, so writing a tag like data-test="{{ backgroundUrl }}" works nicely


texts: I am trying to use panels to implement something that in the past I had done with blocks. My theme has a region called "content top", this displays content above the secondary menu (the tabbed menu that every node has with view edit etc). When I switch over to panels, I can't figure out how to place content in any other region except for the main area ... any ideas


texts: Set value on a new term based on a vocabulary custom field

texts:
I want to set the value of a field of a term based on a custom field set on the vocabulary. Basically if the vocabulary promote_to_index field is checked I want to the field_index_page of the term checked.

I understand I have to write a hook like but I don't understand how to get the value of the vocabulary custom field

function polaris_drupal_taxonomy_form_alter(&$form, FormStateInterface &$form_state, $form_id) {

  switch ($form_id) {

    case 'taxonomy_term_category_form':
    case 'taxonomy_term_article_type_form':
    case 'taxonomy_term_main_purpose_form':
    case 'taxonomy_term_tags_form':
    case 'taxonomy_term_content_partnership_form':
    case 'taxonomy_term_traffic_source_form':
    case 'taxonomy_term_client_form':
      $form['field_index_page']['widget']['value']['#default_value'] = true;
  }
}


texts: Manual Update from Drupal 8.7.6 to 8.7.7 Acts Like New Install

texts:
I have been manually updating Drupal 8 core successfully until now. When I try to update from 8.7.6 to 8.7.7 it goes to a new install.

Here is what I did

Back up database, and back up entire site folder to my computer hard drive
Upload new Drupal Core folder to my computer hard drive
Remove modules, profiles, sites, themes folders from new Drupal Core folder
Swap in old modules, profiles, sites, themes and libraries folders from old Drupal site to new Drupal Core folder
Upload new Drupal core folder to c-panel
Put site into maintenance mode
Change name of original site to "Old original site"
Change name of Drupal Core folder to "original site"
Take site out of maintenance mode

In the past, this worked, and the site was updated. This time, the site goes to a new-install. To deactivate the new install, I went back to the c-panel, and renamed everything to the original names, and the site was back to its original un-updated state.


texts:
How can I add a custom form to a Panels page in Drupal 7?

return drupal_get_form('my_custom_form');

I would prefer not to use the PHP input filter if possible.


texts: Change the disabled status of a form element via Ajax

texts:
I have a form built with the Form API. I have a field which is, at first, disabled. I want to change the status of that field to enabled when the user selects another contiguous field.

I have a working example of changing the callback URL of Ajax complete of that field, so the form is making a kind of OnChange and working well, but for some reason I am not able to change the disabled status.

Code. Here the 2 elements, first brand and next the model, which is disabled at the beginning.

 $form['brand'] = array(
'#type' => 'select',
'#title' => t('Brand'),
'#options' => $brands,
'#default_value' => $brand,
'#ajax' => array(
    'callback' => 'hook_models_update',
    'wrapper' => 'models_wrapper',
    'progress' => array(
        'message' => '',
        'type' => 'throbber',
    ),
),
);

 $form['model'] = array(
    '#type' => 'textfield',
    '#title' => t('Model'),
  //    '#description' => 'Please note available models change based on the brand selected.',
'#required' => FALSE,
'#autocomplete_path' => 'providers/autocomplete/' . $brand,
'#attributes' => array("placeholder" => t('Model')),
'#prefix' => '
',
'#suffix' => '
',
'#disabled' => TRUE,
);

Now the code for the "onChange" behaviour, which is a "throbber" called hook_models_update:

function hook_models_update($form, &$form_state) {
    unset($form_state['input']['model'], $form_state['values']['model']);
    $brand = $form_state['values']['brand'];
    $form['model']['#autocomplete_path'] = 'providers/autocomplete/' . $brand;
     $form['model']['#enabled'] = TRUE;
    // $form['model']["#disabled'] = FALSE
    return form_builder($form['#id'], $form['model'], $form_state);
} // function

I have tried with #enabled = TRUE and with #disabled = FALSE, with no successs.


texts: Only Admin allowed to alter order in 'Review' state

texts: How can I make an Order with status of Review read-only to the creator user? And once the Admin updates to state to 'Payment', the creator user can continue as normal?


texts: How to autocomplete taxo term (inside a paragraph) when using a filter in a view

texts:
Here is a node structure which is storing cooking recipes

recipe (node)

-title (string)

-field_ingredient_quantity (paragraph) => see below the definition

-... (other fields)

field_ingredient_quantity (paragraph)

-field_ingredient (taxonomy term)

-field_quantity (float)

Let say that I woul like to filter in a view all recipes containing mustard with the autocomplete filter on field_ingredient (inside the paragraph type field_ingredient_quantity)

Is it possible?


texts:
This is a really dumb question, but I simply want to create a basic page with it's own path, (i.e. mysite.com/contact) so far I've only had to use Views to display node data. Views have the option of specifying a path, but I'm assuming I don't have to create a view to display a regular page?

The Drupal docs say the default installation comes with the "Basic page" content type, so I tried creating that content type, but I can't see an option to specify a path...

I feel very silly >.<


texts: Using drupal to run a download website with about 10K files

texts:
I want to run a website which has more than 10000 files available for download.Is sites/default/files a good place to store the files?
I see some websites store their files in someting like server1.example.com/file1.zip or drupal.org uses ftp for project files.

Which one should I use?


texts:
I want to implement a Dependent Dropdown for a custom field widget.

I have a custom field with 5 select boxes. Each subsequent dropdown should populate based on values from previous Dropdown. I have a 5 functions that takes arguments to get the values.

I have implemented that, but I need to Ajaxify it, so that I can populate without page refreshes. Any pointers on how to do that?

Basically, I am trying to implement the below thing (from examples module) with FieldWidget.

https://cgit.drupalcode.org/examples/tree/ajax_example/src/Form/DependentDropdown.php


texts: Set to the language of admin pages to english despite the language of front pages?

texts:
Possible Duplicate:
  Do not translate the admin area / How can I set the language of the admin area to English?

Just that. I have a multilingual site but I'm very used to see the admin pages in english. Let's say I'm creating a new node in spanish then I see all in spanish language. Is there any way to set the language of admin pages to english despite the language of front pages?


texts:
I have a site with three grouptypes (organic groups).
I am still sort of finding out the right structure as i want each group type to have
their own (predefined) taxonomyterms. (og vocab will not work as this is per group)

Should i give each grouptype a different groupcontenttype. This way i can divide my vocabularies over each groupcontentype. This way i will have a clear distinction per grouptype. However it results in more maintenance as i need to make views (filtering taxonomy) and panelpages per grouptype.

Is there some other way that i am not aware of using just one groupcontenttype for all my grouptypes and being able to set the proper vocabulary on them?


texts: How come images with image styles are blurry?

texts:
We have noticed that images that are displayed using Image Styles are blurry. Below are the settings we have enabled.

The original images look fine and scale accordingly when using those on the pages, but not the Images with Image Styles. How can this be resolved?

GD2 Image Manipulation Toolkit settings: JPEG set to 100%
ImageMagick module but the results are the same.
We also tried to use JPEG and PNG

View mode (field setting):

formatter = image
Image style: Banner Image

Banner Image Image Style settings:

Scale 1600px (W) by 900px (H)
Allow Upscaling = false

CSS and HTML used:

<div class="banner__image" style="background-image: url('/sites/default/files/styles/banner/filename-banner.jpg')";>

.banner__image {
  width: 100%;
  height: 100%;
  background-position: center;
  background-size: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}


texts: How do I remove the ellipsis button in the pager?

texts: I have a view with video and have replaced the links to different pages with a button. However, when there are many videos, an ellipsis (...) appears floating, and I want to remove it. I have the View with full pager but I don't see how to control this to hide it. Thanks!


texts: Create template suggestion for item-list.html.twig

texts:
I have to change the markup and I have to add CSS classes to themes/classy/templates/dataset/item-list.html.twig. But only for a specific item-list.html.twig in a specific block.

How do I create a preprocess function, which create a template suggestion for this item-list.html.twig? So I am able to use e.g. item-list-facets.html.twig?


texts: How to access personal contact form in search

texts:
Using Drupal 7. All of the people on my site have personal contact forms. When I type their name into the search bar, I get 'no results'.

I need people to be able to find users' personal contact form links by using the search function.

I'm using the core Search module and have enabled 'users' to be included in the search, but no results come up, regardless of which name I use. Site has been re-indexed, caches flushed, etc.

All users have a status of 'authenticated' and permissions have been set on 'contact' and 'search' to allow the results to show.

Any help is appreciated. Thanks.


texts: Difference between strongarm, field base, and field instance

texts:
What is the difference between the following options when using features? What is each of them for and an example of why each would be used.

strongarm
field base
field instance

To make things even more complicated, there are often "field bundle" variables listed for strongarm to use.


texts: How to see recently inserted terms in the site?

texts:
I've many of my people tagging content in my site. I'd like to review all those newly entered terms of any vocabulary. Is there any easy way to do so? I understand there no author/date time entry when a new term is added.

I know one crude method. I can remember the tid from yesterday and display all terms greater than it if I want to see today's entry.


texts:
I want to explain this as simple as possible...

I have a main navigation placed into the main_navigation block in my site
and I want to add a sidebar menu if the CURRENT main_navigation page has
child menus...

For example:

My main navigation is: Home | About | Services | Blog | Contact
Us
I added Request Quote page/form as a child of Contact Us
so when I am in Contact Us page, I want to show Request Quote in the
sidebar but don't show it if I am in About or Services

I saw this question but can't duplicate it

Get menu link siblings

Any help is welcome!


texts: What specific modules are included in Drupal Commerce Kickstart?

texts:
Drupal Commerce Kickstart is a project built on Drupal Commerce that bundles Drupal 7, Commerce and a host of additional modules with some preset settings to speed up Commerce-based development.

I'm trying to find out what specific modules are actually included in this bundle, but all I can find is uninformative advert pages like this.

There's nothing about what exactly is included in the Kickstart documention. The closest I can find elsewhere online is this list of modules not included.

Is there any simple list of the modules that are bundled in the Commerce Kickstart package?


texts: What's wrong with my code to overwrite a block template?

texts:
I want to render a template from a custom block.

When I check the source with Twig debug enabled, I see the following output.

Moz: Graph

My module structure is the following.

wk_elastic
  Plugin
    Block
     MozGraphBlock.php
  templates
    block--wk-elastic.html.twig
  wk_elastic.info.yml
  wk_elastic.services.yml

The code I use to build the block is the following.

/**
 * @file
 * Contains \Drupal\wk_elastic\Plugin\Block\MozGraphBlock.
 */

/**
 * Provides a 'MOZ: Graph' block.
 *
 * @Block(
 *   id = "moz_graph",
 *   admin_label = @Translation("Moz: Graph")
 * )
 */
namespace Drupal\wk_elastic\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use Elasticsearch;

class MozGraphBlock extends BlockBase {
  /**
   * {@inheritdoc}
   */
  public function build() {
    $hosts = array(
      '192.168.10.10',
    );

    $client_builder = Elasticsearch\ClientBuilder::create();
    $client_builder->setHosts($hosts);
    $client = $client_builder->build();

    $query = array(
      'query' => array(
        'match_all' => array(),
      ),
    );

    $params = array(
      'index' => 'moz',
      'size' => 10000,
      'body' => $query,
    );

    $response = $client->search($params);

    return array(
      '#markup' => $this->t('Hello, World!'),
      '#theme' => 'block--wk-elastic',
    );
  }
}

What is wrong in my code?


texts:
I've been struggling for a while to figure out how to support higher pixel density screens for my images in drupal. I have 3 variations for every image on the site (@1x, @2x, @3x) but I haven't been able to find an easy way to use them. I searched around and found articles like:
https://www.advomatic.com/blog/adding-responsive-images-to-your-drupal-8-site
and https://evolvingweb.ca/blog/making-drupal-websites-retina-ready

but they usually talk about using the retina module for drupal which seems to not pass security adviory policy or are just adding different image styles and using the picture tag. Is there no way to use just srcset and using 3 different images for different dpi in drupal?

Ideally I'd like to have an image field which will just let me upload 3 images for different dpi.


texts: What would be the minimal modules I need to have for a simple registration page?

texts:
I would like to make a registration page that is only going to add Users to a list for an event, basically my site is not as concerned with accounts and detailed registration we only really care about name and a contact email that we can add to a list.  Basically it's a group that has monthly events and all we ever really need is a way to track people who say they will attend, not a lot of heavy requirements for people to modify their registrations (most won't anyway) or capture a lot of information.

The various registration and event options for Drupal look overwhelming, I am using Drupal 7 and at this point using only modules and the CMS system to add pages (no coding yet).  Is there a minimal set of modules that would give me the ability to obtain just a User's name and contact info (email or whatever) to put onto a list in a page?  Or for this is it just easier to just code a page that can add in what I want using PHP or JSON.


texts: Splitting exposed form filters amongst several blocks

texts:
I have a views search page in D8 where I'm I have exposed filters that are shown in blocks. I'm also using search facet blocks. What I want in the sidebar is the exposed filter text search field, followed by the facets, and then an exposed filter for selecting a date range.

I've seen a few places mention you can create a duplicate of the views page keeping the same path and have one set of filters in one views block and others in an additional views block. I think this was for D7 because I can't make it work in D8. Basically they replace the url arguments when one or the other is submitted instead of combining them like they normally would do.

What I've currently done is shown the exposed filter block twice and using CSS (display: none) to  aria-hidden="true" hide the redundant exposed filters from screens and assistive technology.

It gets flagged though when I used WAVE to test its accessibility since there are duplicative form labels. It's also, imho, a nasty hack and I'd rather do it the right way if possible.

Is there a right or better way?


texts: Themekey with mobile detect not working properly

texts: I am using themekey module with mobile detect module for switching mobile and desktop version of themes. Some time it works and some time not. On Apple devices it load the mobile version. I'm currently using a Shared Hosting provider and I'm using boost module in order to generated my caching.


texts: I'm a newbie, working on a project which need to use the webform act as warranty form, the form got a date field. After the user submitted the form, the submission result page should show the expiry date of the warranty, but I don't know how the expiry date can be show?? Could anyone who can help me how to do that?? million thanks


texts:
I am getting the following error and I don't know why this is happening.

  User warning: Incorrect key file for table
  './edubridge/watchdog.MYI'; try to repair it query: INSERT
  INTO watchdog (uid, type, message, variables, severity, link,
  location, referer, hostname, timestamp) VALUES (6,
  'imagecache', '404: Unable to find %image ',
  'a:1:{s:6:\"%image\";s:64:\"sites/all/files/pictures/cactus_flowers_beauty_Funzug.org_12.jpg\";}',
  3, '',
  'http://edubridge/sites/all/files/imagecache/members_87/pictures/cactus_flowers_beauty_Funzug.org_12.jpg',
  'http://edubridge/assignment/list/8223/556',
  '192.168.99.171', 1317211007) in _db_query() (line 149 of
  /var/www/html/edubridge/includes/database.mysql.inc).

Does anyone know how to fix it?


texts: How to edit comment reply link for specific content type in Drupal 7

texts:
Is there a way I can programmatically edit comment reply links for a specific content type in Drupal 7?

So I need to check for the content type before changing the links:

<?php
if ($node->type == 'book') {
  // change comment reply links here
}
?>

Does anyone know how this can be achieved? Is there some sort of hook I need to implement?


texts:
I am trying to set up a user to user rating system where users can rate nodes and the average is the users rating / total feedback.

I was thinking about using fivestar to create a field on the user profile, then create a fivestar reference (which doesnt exist to my knowledge) to that field so when a user rates a node they aren't rating the node, but the user's rating field attached to their user profile.

Is their a way to get users to rate nodes authored by a user and have it total up to give the user the average rating? I wanted something easy and light without having to create a feedback content type with a fivestar field and using entity prepopulate to pull the user in to link the user to the review content type. Or do it with entityforms/webform.

Would this be doable with flag since I am already using it pretty extensively?

Thanks.


texts: I would like to know how I can host my own Bootstrap 3 files (js, css) in the Drupal 7 Bootstrap 3 theme. I know I can deactivate CDN hosting inside the theme settings, but I can't get it to work. Can anyone of you guide me through?


texts: Using multiple sort criteria on a view, can't get them to play nicely

texts:
So, I have a view (D7, Views 3) that provides a list of staff with a thumbnail image based on a location "contextual filter". Some staff members are set as "sticky" and need to appear above all the others. All staff members also need to be sorted by last name, which i'm doing with a custom php sort.

So, first, stickied staff members should be shown sorted by last name. Next, unstickied staff should be shown also sorted by last name.

Last name sort works great, but I can't get the view to group them by sticky.

Here's a screenshot of the view: http://grab.by/h2Gg
Here's a screenshot of the first part of the output: http://grab.by/h2GA (Jeremy Irwin is stickied, so should display at the top)

Here's the php code i'm using for the last name sort:

list($fname1, $lname1) = explode(' ', $row1->title , 2);
list($fname2, $lname2) = explode(' ', $row2->title , 2);
return(strcasecmp($lname1,$lname2));

Any suggestions why this isn't playing nicely with sorting by sticky?


texts: is there hierarchical user level structure in drupal

texts:
Is there any hierachical structure of user in Drupal?
I just see user role in drupal, but can we define some level of user?
As example:

user1
--user2
---user3
--user4
---user5
---user6


texts: I have two custom page views, one showing content, and a second one showing taxonomy term. The first one's template override suggestion as expected is    views-view--{viewname}.html.twig, I do not get the same override functionality for the second view though. Am I missing something here or is it just the way it is?


texts: Is there a Drupal way to loop over Webform fields in form alter function?

texts:
Since $form['submitted'] array has also other keys than just field names e.g. #tree, what is the correct way to loop over this array?

I need to add a #prefix and #suffix for each field and for now I've just created condition !is_numeric(strpos($fName,"#"))
This tells if it just a field name or if it holds render array properties or whatever they are called.


texts:
I want to crop an image that is anchored at the center, but only crop the height.  How can this be done in Drupal 7?

EDIT: The process needs to be automated.  Basically I desire the functionality of the existing crop process for an image style, but without the requirement for having to enter a value for both width and height.

EDIT #2:  The width needs to be variable :)


texts:
I want to do something like this

    $index = search_api_index_load("node_index");
    $myQuery=new SearchApiQuery($index);
    $myQuery->condition('type', 'blog', '=');
    $data=$myQuery->execute();
    $results=$data['results'];
    print_r($results);

but for Drupal 8, using the search api. Is that possible?


texts: OpenModalDialogCommand without site configuration permission

texts:
I have a custom module in Drupal 8.9.9 to open a form in a modal dialog with OpenModalDialogCommand.
The custom_modal.routing.yml file has:
custom_modal.open_modal_form:
  path: '/modal_form/{title}/{vocabulary}'
  defaults:
    _title: 'Modal Form'
    _controller: '\Drupal\custom_modal\Controller\CustomModalController::openModalForm'
  requirements:
    _access: 'TRUE'
  options:
    parameters:
      title:
        type: String
      vocabulary:
        type: String

And the CustomModalController.php:
  public function openModalForm($title, $vocabulary) {
    $response = new AjaxResponse();

    $values = array('vid' => $vocabulary);

    $term = \Drupal::entityTypeManager()
      ->getStorage('taxonomy_term')
      ->create($values);

    $form = \Drupal::entityTypeManager()
      ->getFormObject('taxonomy_term', 'default')
      ->setEntity($term);

    $term_form =  \Drupal::formBuilder()->getForm($form);

    $response->addCommand(new OpenModalDialogCommand($title, $term_form, ['width' => '800']));

    return $response;
  }

My theme has the following dependencies:
global-scripts:
  dependencies:
    - core/jquery
    - core/drupal.ajax
    - core/drupal
    - core/drupalSettings
    - core/jquery.once
    - core/drupal.dialog.ajax

And I have even added the following to my custom_modal.module:
function custom_modal_form_alter(&$form, &$form_state, $form_id, $no_js_use = FALSE) {
  $form['#attached']['library'][] = 'core/drupal.dialog.ajax';
  $form['#attached']['library'][] = 'core/drupal.ajax';
}

Nevertheless, whereas everything works fine when I use the site administrator, when using a simple authenticated user the modal dialog does not open and I get the following error:
There was an HTTP AJAX error.
HTTP Result Code: 403
Below is the information on debugging.
Path: /modal_form/Create/style
StatusText: Forbidden
ResponseText: {"message": "The administer site configuration permission is required."}"

Any ideas? Thanks in advance


texts: Need advice on how to go about creating a very specific custom menu

texts:
I have the need to create a custom menu that is giving me quite the challenge. I have a site that focuses around properties as the main content type. Several other content types have references to the property, such as creating journal entries or activities.

Several paths were defined via a hook_menu instance where each path was a MENU_LOCAL_TASK. Others, such as journals (which is its own content type) were just done using the standard drupal form so they didn't require an entry in hook_menu.

I am in the process of trying to create a property menu that will cover any and all things that one can do for a property. I want to create a menu of all the links that are applicable for a property, even if the content is of another content type with a reference to a property. Initially, I thought a block would do just fine and I could create custom markup that would mimic a menu. However, several of the links would need access to the $node object that represents the property, and hook_block_view doesn't seem to have a way to pass parameters as you can with hook_menu.

Hook_menu doesn't work for all my links either cause some of them aren't part of the actual property content type. I realize this is confusing and I apologize for that, but if anybody has faced a similar type of problem and can offer some suggestions, I would appreciate that. To complicate matters even more, one user can have more than one property, causing all of the links in this menu to change for each property they have.

An example menu and paths might be something like this

Overview - node/[property-nid]/overview (custom page - hook_menu local task)
map boundaries - node/[property-nid]/map/edit-property (custom page - hook_menu local task)
Map features - node/[property-nid]/features/manage (custom page - hook_menu local task)
Journals - forest-journals/[property-nid] (a view)
Activities - activities/[property-nid] (a view)
Foresters - foresters-near-me (a view)


texts: Auto-complete and form auto-populate from wikipedia

texts:
I have some taxonomy terms that would benefit from being (at least in part) being based on wikipedia articles.

It looks possible to make a request via the wikipedia api in PHP, and then link that to my Term via Computed fields, but to make the initial request I need to relate the restful query to the term. I found something similar, but I have no idea how to make this work in my example...

Is there a module out there that would let me run a prefixsearch query to show autocomplete options while typing in the term name on the 'add new term' page, and then autopopulate using a parse query?

Is no module how would I go about coding this up? I don't have any PHP knowledge but it looks like it wouldn't be too hard to do.


texts:
Hi i'm just starting out with Drupal, Have what I think is a really simple question and it has been asked a lot but the answer dont work for me.

I am using the Stark theme to start to buid a theme. I am trying to remove the main menu text from above the menu, please see

I have tried How to remove "Main Menu" title from Stark Theme but this does not work, infact if I remove the block from admin/structure/blocks the menu still shows.

Does any one know how I can fix this?

Thanks.


texts: Inline labels for exposed filter forms in Views 3

texts: How do I make labels inline for exposed forms in Views 3?


texts:
I'm using Drupal 7 and create a module for my content thumbnail images frontpage display. Working this:

 if(count($p_detail->field_slide) > 0){
            $output .= '
';
            $output .= '
';
            $i=6;
            foreach($p_detail->field_slide['und'] as $thumb):
                $img_path = $thumb['uri'];
                $img_url = image_style_url('tmb_240x117', $img_path);
                $img_file = 'title.'" />';

                $output .= '

                                    '.$img_file.'

0'.$i.'

';
                $i--;
            endforeach;
            $output .= '
';
            $output .= '
';
        }

My thumbnails, field_slide and i want only first 6 thumbnails (if have 6 images... for exam, have 2 images, display 2 thumbnails)

How can i do this?


texts: Username display overidden by customer profile name

texts:
If a user has a customer profile (i.e. ever filled out a shopping cart) the name in the profile is used everywhere their username is displayed.

This results in a lot of confusion for our moderators/admins.  Because when they go to lookup a user in admin/people they're looking for the username that the user logs in with.  But what's displayed is their "nice" name from their shipping address.  I need to undo this override because it's way too confusing.

It doesn't look like anyone is doing this through theme_username().  Where is this display override happening?


texts: Drupal7 GMAP module, show and hide certain markers

texts:
I am using GMAP module on Drupal7 for Google Maps. I am using it with Views module. Have created map view with markers from content type. Everything works fine.

Now I want to be able to show and hide some markers (not all) based on for example some category or any node field. How can I manipulate (just show and hide some of them) markers outside the view? Or maybe there is a possibility to do it within view?

Thanks.


texts: Copy a field's value to another field and modify it

texts:
I have content type "Video"
When i do a new "video" I have a field "iframe_vimeo" thats it contains a value of the iframe's video link.
I want to do some modifications with the value of this field and put the result in a new field "Link Modificated"
I try to make an example:
I create a new Video:

I fill the fields.
My field "iframe_vimeo" has the value

"<iframe src="https://player.vimeo.com/video/66865270?color=ff0179" width="640"
> height="360" frameborder="0" allow="autoplay; fullscreen"
> allowfullscreen></iframe>"

I save and create the Video

Now i want to obtain the value of my "iframe_vimeo" and make some modifications  and fill my field "Link Modificated" with the result and save it.
field "Link Modificated" result value =
"https://i.vimeocdn.com/video/116320565_100x75.jpg?r=pad"

I saw the function mymodule_form_FORM_ID_alter(&$form, &$form_state, $form_id) but i dont know to work it.
I need some help please!
EDIT:  the field "iframe_vimeo" It's not an obligatory field, but always its fill, i want to fill the other field ("Link Modificated") with the modifications. Besides, if someone edit a Video Content and modify the field "iframe_vimeo"I will have the refill the field "Link Modificated" with the new modifications value.
Thanks, very much


texts:
So I'm giving REST a try. Installed drupal-8.0.0-beta12 in a VM. cURL works fine using curl http://testing.dev/drupal8/node/1?_format=json but I'm not sure why I'm getting a 403 error message using dev HTTP client:

Any ideas?


texts: Is it possible to divide a field into fields?

texts: I think this is impossible. However, is it possible to change a field into fields on Drupal 7? I have a content type of author. We used the "Title" field for user full name with their title. Is it possible to change it to "First Name", "Middle Name", "Last Name", and "Title" fields?


texts: New login required to view images from the private folder (while logged in)

texts:
I'm having a strange problem with the images on my website (Drupal 7.19). After migrating the site from the testing to the production server we weren't able to see images we've uploaded. Since we're a closed community all the images are uploaded to the private folder, which perfectly works. The images are there in the folder.

But when we try to access the images (and if it's just showing them as thumbnails on the page) we get a "broken image" icon - they're not available, neither the thumbnails nor the large version. The Drupal log then says "Access denied" for the user "guest", for every logged in user, even me as administrator. If I try to open the image via the direct link (e.g. from the Drupal log) Drupal shows a login page and after I log in I can perfectly see the image.

So I find this rather strange and I don't know how I should fix this problem. Since we needed a tight security plan I installed several extra modules like "Content Access" and "Taxonomy Access Control". I wonder if it has something to do with that? Or with the new server?

Thanks for reading and I hope someone can help me! I'm already pretty desperate!

Have a nice day,
Svenja


texts: How to return JSONP from a menu callback

texts:
I can create JSON output using a menu hook using the drupal_json_output callback.

Example:

$items['page/%/json'] = array(
  'access callback'   => TRUE,
  'page callback'     => '_modulename_json',
  'delivery callback' => 'drupal_json_output'
);

function _modulename_json() {
  return array(
    'item1' => $field_item1[0]['safe_value'],
    'item2' => $field_item2[0]['safe_value'],
    'item3' => $item3,
    );
}

Output:

{"item1":"Field item1 content","item2":"Field item2 content","item3":"Item3 content"}

But I need to have JSONP, and am struggling to find an elegant solution... I have tried the code from the bottom of the API page, it does the padding, but makes a mess of the content.

$response = array(1,2,3);
$callback = check_plain($_REQUEST['callback']);
// If its a jsonp callback request
if (isset($callback) && $callback != '') {
  $json_response = drupal_json_encode($response);
  echo $callback ."(". $json_response .");";
}
else {
  drupal_json_output($response);
}

Output this way:

callbackName({\u0022item1\u0022:\u0022Field item1 content\u0022,\u0022item2\u0022:\u0022Field item2 content\u0022,\u0022item3\u0022:\u0022Item3 content\u0022});"


texts: List the hooks that can be used in .install file?

texts:
I have found only few hooks that can be used in the .install file. They are:

hook_enable
hook_disable
hook_install
hook_uninstall
hook_requirements
hook_update_N
hook_schema
hook_schema_alter
hook_update_last_removed
hook_field_schema

Please tell me if I have left any hooks.


texts: Views 3 (D7) Attaching custom markup to individual view results

texts:
Ok so a bit of background first on why I want to do this, this may also spark someone to suggest a better way of doing this also. I'm always open to ideas!

Basically I have a bunch of content types, call them rooms for the moment.
I am using views to sort/search these rooms, works great (as expected with views).

Now what I want is to attach some php and an jquery script to each view result itself, this script will get an ID from a field attached to the view result, this will then be sent as an ajax request get some information and then come back with some results which will then be printed underneath the view result.

How do I go about doing this? I've taken a look at a few of the different hooks available for the views api but can't really figure out which one is the one I want.

Any suggestions are greatly appreciated. Dan


texts:
I'm trying to load https://github.com/PHPOffice/PHPExcel in a custom module.  I've successfully added the library dependency to the composer.json file and Composer correctly downloads it into the 'vendor' folder.

The PHPExcel library doesn't use namespaces.  How do I access the library?  The following line

PHPExcel_IOFactory::load($excel_filepath);

results in

Fatal error: Class 'Drupal\mymodule\Form\PHPExcel_IOFactory' not found in /home/me/webs/client/myhomedir/modules/custom/mymodule/src/Form/ImportProductsForm.php on line 60

If possible, I'd prefer not to use the Libraries module.


texts: Change list of values dynamically with a click

texts:
I realize my request is a bit complex, I hope someone can answer.

I have a drupal 7 clean installation. I have a node type called Whole and another one called Piece. A Whole contains one to many Piece: I used the Entity module (with Entity reference) to link entities. The Piece node has a boolean field called selected.

When a user views a Whole node he can see all the Piece elements linked to it.

I need to allow an unlogged user to set the selected field of the piece node to true without leaving the Whole node page. I also need to keep track of the selected Piece elements (maybe in a session variable?). In the end I need to list all the Pieces altered in the session to compose a mail. When the mail is sent the session is cleared.

Is there a module that allows in place edit of node attributes?? I have installed and tried Editable Views, but it doesn't work. Maybe there is a conflict with my drupal version (7.14) which unfortunately I can't change.


texts:
I have a drupal 7 driven website.
I need to replace a handful of pages on that website using static HTML without impacting the URLs of those pages.

For example I have a page accessible at: example.com/services/
That page is a proper drupal driven page. I want that page to display a proper HTML page I've written from scratch without any input from drupal engine but still retain the same URL so anything that leads to that page (internal & external links) would continue to work.

What's the correct way to set that up.
Thank you!


texts: How to redirect views of entity types (bean) for user roles?

texts:
RabbitHole does not provide this functionality for bean blocks and Entity Bundle Redirect does not seem to work. There is a user role which may edit bean blocks but I want to prevent them from viewing the bean block itself, it rather gets included via php/ views on different nodes.

How can you do that?

EDIT

this is the way the bean blocks are printed

<?php
    $bean_left = bean_load(2);
    print render(bean_view($bean_left));
?>


texts: How do I get entity_type and entity_id from any entity page?

texts:
Some pages (paths) represent one entity. For example:

The pages at these paths represent one node entity, entity_id (nid) is XX:

/node/xx
/node/xx/delete
/node/xx/edit

The page at this path represents one search server entity (defined by search api module), entity_id (machine_name) is 'apache_solr':

/admin/config/search/search_api/server/apache_solr

How do you load in the basic data about this entity (id and type) when the hook or function you are in doesn't hand it to you?

The standard way to get the current entity is apparently to use menu_get_object($entity_type,$position_of_id_in_url). This, however, assumes that you are coding for just one entity type: you need to state the entity type programmatically, and, even worse, you the human being need to research and hard code in the url position of entity ids that this entity uses.

The closest I can find so far is getting the underlying system uri for the page (e.g. substr(request_uri(),strlen($base_path))), then writing a monsterous switch list based on something like this suggestion, guessing and then hard coding cases for every possible entity you think a site might ever have. But there must be something better than that, right?

While a general solution from core would be best, I'll also accept an answer that depends on common modules like ctools (page manager, contexts, etc), Entity API, Devel, etc.

My immediate need is for edit forms, within hook_field_widget_form(), for a widget that can (with appropriate config and modules) be attached to any fieldable entity type. So, while a general solution would be best, I would also accept a narrow answer that only works within this function or in forms (The id and data that is specific to entity type appears to be buried in $form, but keyed in an entity type specific way, so getting it out of $form seems like a chicken and egg problem).

------------ EDIT ------------------

Seems some people have difficulty understanding the simple general problem. Here's an alternate use case (another seperate but related problem I'm facing). Suppose you have a view that lists some entities. This view sits as a block/pane on pages that can represent one entity, such as a node page or a user profile (or both). You've got a hook set up that reads the views data and looks through the results (foreach $view->result as...). Let's say it's hook_views_pre_render, which means you just have the $view object. You want to do something (say, remove the row or change some field data) if the view results row has the same entity id and entity type as the page does. You've got the logic down to extract this data from the view results, so all you need is to look up the entity_type and entity_id of the page being generated, to make a comparison. That data is in Drupal somewhere. If it wasn't, Drupal couldn't have figured out that it needed to load this view. So how do you get it when it isn't passed to the hook or function you are in?


texts:
I have tree element exposed on a View, two Select Box and a custom filter (textfield). I set up the View for Autosubmit (Automatically submit the form once an element is changed). For the two Select Box is OK but for the textfield is a problem because the page is submitting after every key up.

There is any options to do the textfiel stop the autosubmit behaviour on Drupal 7?


texts: Allow blank search/list all items with 1.x apache solr module

texts:
When a user enters a blank search, by clicking "search" right away, or entering the search result url directly, the initial version of the Apache Solr Search Integration module, 6.x-1.x series, tells the user to "Please enter some keywords".

I would like it to issue the empty search, thereby returning all available results. This question List all available items with Apache Solr if the search keyword is empty asks the same for the second generation of the module, 6.x-3.x and 7.x-1.x, but that answer doesn't apply.

I've tried hacking out the if ($keys == '' check that yields the "error" message, but that simply results in no results at all.


texts:
How can I say Panels to show region title while rendering the page?

I have a panel region containing 4 node previews and I want to print a title before them. It would be like a "wrapping section" in my home page.

Is it possible?


texts:
I have a list of Categories defined that all have specific URL aliases defined. I'm trying to set up views for those specific feeds.

For example, if I have categories

cats, dogs, fish (with aliases /cats /dogs//fish`) I'm trying to set a view for those pages.

I know I can create a view and say Show Content of Type All tagged with:___ but I believe that works off tags, not categories.

If I try to say Show Taxonomy Terms of type Category then it looks like it's just a list of cats dogs fish

Is there a nice way to set up what I'm trying to do, or am I better off using tags instead?


texts: register.json does not login the user or return the user's session/token/password

texts:
I have tried far too many variations to list here, but the basic point is I cannot get the user logged in immediately after registration via Services. I have tried a fresh Drupal 7.33 install with only Services 7.x.3.11 enabled and the default resource settings provided by drupalgap 7.x.1.9

When I register using the Drupal interface, the user is created, the session opened, and I land on my profile page logged in.

vs.

When I call the Services endpoint /services/user/register.json, Drupal creates the account but the session does not persist. See my screenshots below.

How can I either A. get the session to persist for subsequent Service resource calls OR B. hook to add the user's or auto-generated password back into the json response so I can programmatically resubmit the /login.json form client-side (which does persist) ?

This question how could the global $user be different between the Drupal interface and Services module? describes my same problem using LoginToboggan.

In my screenshot you'll see a debug line called "login debug". It comes from line 333 of "/sites/all/modules/logintoboggan/logintoboggan.module" where I've tried all of this to no avail...

function logintoboggan_process_login($account, &$edit, $redirect = array()){
  global $user;

  $user = user_load($account->uid);

//watchdog('login debug', json_encode($account));
watchdog('login debug', json_encode($edit));

  //user_login_submit(array(), array('uid' => $account->uid));
  user_login_finalize($edit);

//  $user = user_load($account->uid);
//  $user->token = drupal_get_token('services'); // WE HAVE A TOKEN ALTHOUGH I DOUBT THIS WOULD WORK IN TERMS OF SESSION PERSISTANCE
//  user_login_finalize($edit);
//  module_invoke_all('hook_user_login');
//  module_invoke_all('tripchi_user_login');
//  module_invoke_all('logintoboggan_user_login');


texts:
I've created a custom entity and in the next step, I would like to use the Entity Translation module to make the entity translatable.

My entity is defined like this

/**
 * Implements hook_entity_info().
 */
function MY_MODULE_entity_info() {
  $info['custom_entity'] = array(
    'label' => t('Custom Entity'),
    'base table' => 'custom_entity',
    'module' => 'MY_MODULE',
    'uri callback' => 'custom_entity_basic_uri',
    'controller class' => 'EntityCustomController',
    'fieldable' => TRUE,
    'entity keys' => array(
      'id' => 'qid',
      'label' => 'title',
    ),
    'translation' => array(
      'entity_translation' => array(
        'default settings' => array(
          'default_language' => 'de',
        ),
        'base path' => 'my-path/%custom_entity',
        'view path' => 'my-path/%custom_entity',
        'edit path' => 'admin/my-path/%custom_entity/edit',
        'translate path' => 'my-path/%custom_entity/translate',
        'path wildcard' => '%custom_entity',
      ),
    ),
    'static cache' => FALSE,
    'bundles' => array(
      'custom_entity' => array(
        'label' => 'Custom bundle',
        'admin' => array(
          'path' => 'admin/structure/custom/manage',
          'access arguments' => array('administer custom entities'),
        ),
      ),
    ),
    'view modes' => array(
      'full' => array(
        'label' => t('Full'),
        'custom settings' => FALSE,
      ),
    ),
  );
  return $info;
}

With this definition, my custom entity appears in the Entity Translation admin view (admin/config/regional/entity_translation) and I can configure it. This seems to be correct, because in the 'manage field' tab, the language selector field appears and the 'translate' tab appears also in the edit form.

The only strange thing I found is that the language selector is not rendered in the edit form in any time. If I save the translation, the source entity is overriden with the changes, but no translation is added.

I thought the problem is my Controller class, but this seems to work correctly too:

class EntityCustomController extends EntityAPIControllerExportable {
  public function create(array $values = array()) {
    $values += array(
      'created' => REQUEST_TIME,
      'type' => 'custom_entity',
      'qid' => 0,
      'bundle_type' => 'custom_entity',
      'title' => '',
    );
    return parent::create($values);
  }

  /**
   * Save Task Type.
   */
  public function save($entity, DatabaseTransaction $transaction = NULL) {
    parent::save($entity, $transaction);
  }

}

In my custom edit form, I use field_attach_form function to render all the defined themes.

And, if it helps, this is my save handler:

/**
 * Save entity by using the controller.
 */
function MY_MODULE_custom_entity_save(&$entity) {
  return entity_get_controller('custom_entity')->save($entity);
}


texts: Migrate content types and contents from old drupal version to drupal 8

texts:
I'm working on a new drupal 8 website.
I have already a drupal 7 installation with severals content type (custom field image, date etc ...) and i dont know what is the best pratice to migrate thoses contents types to my new drupal 8 installation..
Does someone know how to do that properly ?
Regards.


texts: Are there migration plugins for D8 sources?

texts:
I found 2 references here for migrating D8 to D8, but both are very outdated.

Certainly there will be a need to do D7 -> D9 or D8 -> D9 migrations for many, but there are also current use cases. One is migrating from a multisite to individual sites.

Mine is the site restructuring its content types, and it would be far simpler to add custom code to a source plugin than to do all of it in custom code.


texts: Admin login returns 'Sorry, unrecognized username or password.'

texts:
When I attempt to login to my admin account, I'm getting a 'Sorry, unrecognized username or password.' message. The weird thing is that the password and username are correct. I've looked them up in the SQL database. I've even tried changing the password in the database, but have had no luck getting it to work. After every 5 attempts, I've had to use the DELETE FROM 'flood'; sql command in order to reset the attempts.

In my local environment, I'm having no trouble logging in. This is also the first time I've attempted to login to the production website.

Is there anything I can try to fix this?


texts: Can IMG URI be displayed in image.html.twig?

texts:
I want to include Magnific Popup in my site. The only thing that left to do is display the URL of the image in link wrapping the image field.

I saw that image.html.twig modify the image of my articles. So, the override works but when I try to use some variables it just don't work (only atributtes and style_name are allowed).

What can I do if I want to display the URL of $var['elements']['field_image']['#blazy']['_uri'](Kint)?

Here is the twig template that I trying to modify:

{#
/**
 * @file
 * Theme override of an image.
 *
 * Available variables:
 * - attributes: HTML attributes for the img tag.
 * - style_name: (optional) The name of the image style applied.
 *
 * @see template_preprocess_image()
 */
#}

UPDATE: If I try to use {{ attributes.src.__toString() }} as advised in comments of this post, I see this output, not the image data:image/svg+xml;charset=utf-8,%3Csvg xmlns%3D&#039;http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg&#039; viewBox%3D&#039;0 0 640 257&#039;%2F%3E


texts: Displaying parent nodes with child nodes - nested views, hard coding, or other approach?

texts:
I have a parent content type which is categorized with a taxonomy term. Then there are child nodes to the parent. When someone clicks on a category, I want them to see a table basically. It would be of the form:

  Parent1
  Description

    Child1
      Description

    Child2
      Description

  Parent2
  etc

Seems out of the box I can't get Views to behave that way, so I was thinking I would have one view that is for the Parents, and another for children of a parent, and then somehow (via Display Suite for instance) have the page display the views one after another. Though I suspect that way of thinking is counter to what drupal is all about, so I am really trying to harnass the power of drupal to make that happen, as opposed to writing a custom module (though in the end I think such a custom module would be easier than Views, but I want to max out my understanding of Views before I go that route).

That said, how would you go about creating the Views and then controlling the display in Display Suite?

EDIT: So I figured out the SQL query that would return the results how I want them. Basically something like this

SELECT n.title, d.field_description_value, n.nid, l.field_lesson_target_id from drupal_node n

JOIN drupal_field_data_field_description AS d ON d.entity_id = n.nid

JOIN drupal_taxonomy_index AS t ON t.nid = n.nid

LEFT JOIN drupal_field_data_field_lesson AS l ON l.entity_id = n.nid

ORDER BY COALESCE(l.field_lesson_target_id, n.nid), l.field_lesson_target_id, n.nid

I made sqlfiddle

So I guess it comes down to whether Views is able to produce such queries.


texts: How to override checkout form validation error message?

texts:
Im using D7 and Ubercart 3. But I think this is more a form question than anything else. When validating the checkout form I get a list of errors saying fields are required. And thats all fun and stuff, but I just want the error to say:

  Please complete the form by filling out the highlighted fields.

And only once off course.


texts: How do I add sidebar with menu, using Display Suite?

texts:
Display Suite layout just shows the full content for node, but I also need to place sidebar on node page.

I realized that I can't place main menu which I already created via menu settings in the sidebar. I notice that full content takes whole page. There is no way to add sidebar for the menu list.

How do I do that? Also how to have menu items set to active if this node is specifically linked?


texts: How to access weight of a paragraph in twig?

texts:
I use paragraphs with my content type. I need to show weight (order) value of each paragraph in my twig template. I can change weight with select box when I edit the node, but I can't figure out how to get it in twig.

I thought it would be something like this:

function ws_preprocess_paragraph(&$variables)
{
    $par = $variables['paragraph'];
    $myweight = $par->weight;
}

Please help)


texts: How to Restrict views Date popup to only year/month

texts:
I want to have views exposed filter on node created field with popup.
I've installed date_popup, the popup appears but I'm looking for a way to restrict it to only year and month.

I tried the following solutions but no success.

function HOOK_form_alter(&$form, FormStateInterface $form_state, $form_id) {

  if( $form['#id'] == 'views-exposed-form-news-page-1') {
    $form['created']['#date_format'] = 'm-Y';
    $form['created']['#date_date_format'] = 'm-Y';
    $form['created']['value']['#date_format'] = 'm-Y';
    $form['created']['value']['#date_date_format'] = 'm-Y';
    $form['date_needed'] = [
      '#type' => 'date',
      '#title' => 'test',
      '#date_date_format' => 'm/Y',
      '#date_format' => 'm/Y',
    ];
  }
  return $form;
}


texts: Textfields and values with a value of 0 get blanked out if stepped forward/backwards

texts:
I have a multipage form programmed with the drupal FAPI having in total 3 pages of fields consisting of textfields, textareas and radios, the form can be stepped forwards and backwards.

On page 2 of the form i have a few textfields where the user needs to enter numeric values. If these fields are not applicable, the user is asked to enter a 0.

The problem I have now if the user fills out that page No. 2, fills in a few 0 in these textfields and steps forwards/backwards, and afterwards steps back to that very page, the fields formerly filled with 0 are blank.

I really have no clue how to solve that as I need to use numeric values.

I now could set the default value to 0 instead of an empty value, but that would force the initial form to have already a 0 set. I do not want to solve it like this.

I have the feeling that the 0 is probably treated as a NULL (but actually in PHP 0 and NULL are different), but I am not sure. Dumping out the form array shows that indeed that 0 values are blank.

A textfield looks like this:

$form['t_2_1_2'] = array(
    '#type' => 'textfield',
    '#title' => t('... label text ...'),
    '#description' => ' ... desc. text ...',
    '#required' => TRUE,
    '#default_value' => !empty($form_state['values']['t_2_1_2']) ?
        $form_state['values']['t_2_1_2'] : '',
);

The structure of the entire form handling is very much based on the drupal multipage form example in the drupal form examples package!

Is there any way how I can solve that issue, that a value of 0 persists in the form, even stepping forward/backward?

I already tried to investigate similar problems, and found one where where the suggestion was to prepend a space to the 0 value, but that is a hack and I do not / can not use that as such!

Any hints are greatly appreciated, as I am sitting on this problem too long now and my time is running out to solve that issue. Thanks in advance for your hints!

Update: As nobody could help me here and my time is running, I solved the problem by using an 'x' instead of the '0' value, changed the validation to check for either a numeric value or an 'x'. Now the values all persist in the form fields, when I jump backwards/forwards in that multipage form. If the user used 'x', the value will be converted into an '0' value in the submit handler because the data is stored into mysql, and these fields are of type integer. At least a way I can live with.


texts: I have a module that is using hook_feeds_presave. I want to only run specific parts of this function based on the feeds importer that is running. How can I check for the ID of the feed? These are standalone feeds and don't use node forms.


texts: How to print add/remove link for user relationships module?

texts:
I want to print Add/Remove friend link fro user relationship module on user profile page. I am trying this using below code but its causing white screen.

//add link
global $user;
$account = user_load(arg(1));
$actions = _user_relationships_ui_actions_between($user, $account);
if (count($actions)) {
  print theme('item_list', $actions);
}

Please help me.


texts: How to fix the useless 'favicon.ico page not found' log message?

texts:
Why is Drupal looking for it in the root dir in first place? The favicon is always placed inside theme at sites/all/themes/mytheme/, but it's looking for favicon.ico inside home / dir.

When browsing website it spams the log error message in the Recent log messages page.


texts:
I have implemented hook_menu_alter() in a module I have created. I have printed something inside that function call but nothing shows up, though the function hook_init() is executed from the same module. The output of hook_init() shows up in the page, but not from the hook_menu_alter() even after clearing the cache.

Does anybody have any idea regarding this issue?

function mymodule_init(){
print "here";
}

function mymodule_menu_alter(&$items) {
print "I am here";
return $items;
}


texts: Alphabetical sorting of terms (not using a view)

texts: I'm using the templates to display my terms rather than views but I'd like to change the order that the items are sorted. Currently it appears to be sorted by date. I would like to sort them alphabetically. Is this something I can do in the temeplate.php or within anywhere else?


texts:
I'm creating a page "from scratch", with routing, controller, etc. The content of my page is created by code, buy I want to add a editable component (the description of the page).

I don't want to use blocks, because I don't wanto to give too many permissions to editor role.

I could create a "custom content" content type to store content and then add node content from code.

Other ways? I was thinking to use configurations, but if I export all configurations with "drush cex", this config will be overridden after editing. A good way could, if it's possibile, to exclude this single component from export.

Other ideas?


texts: CKeditor: Add class to all ul and ol elements on output

texts:
The ul and ol elements are often used in theming outside of the 'text'-context (e.g. category blocks, etc.). Therefore the bullets are removed by default.

Is there a way to add a class to all ul and ol elements outputted by CKeditor? For example class 'editor', so that we can theme the ul/ol elements differently if they are outputted by CKeditor (with bullets or decimals).


texts: What's the best way to assign variables for use in multiple form modules?

texts: We have multiple custom form modules in our Drupal 8 site, and there are variables that are common across them -- like arrays for year, semester and campus, as well as lists of courses (so it's quite a few values, and they have to be updated from time to time). What's the best (most correct) way to define these common variables in a single place so they can be accessed by any module that needs them?


texts: Add html to taxonomy_menu_block taxonomy terms

texts:
I am trying to edit the html of the taxonomy terms printed from the module taxonomy menu block.

Is there a way to add a theme wrapper or to override a template so I can add html to each and every taxonomy term?


texts:
I am new to drupal. I have created a block from module using hook_block_info() and hook_block_view(). This block will be used as front page image slideshow. So I want to provide text fields in the configuration page of that block where user can add Image files for slideshow.

What is the process of creating configuration form for the block. I searched online but couldn't understandable solution. Thanks!

I am using Drupal 7


texts: Where can I learn about how to create a custom exposed filter for Views 3 and D7?

texts:
I am trying to learn how to create a custom exposed filter for a contributed module (select or other).  I found this tutorial for Drupal 6 but the code doesn't appear to work out-of-the-box on Drupal 7.

I also tried looking at the code in the hierarchical select module but it seems to be much more complex than what I am trying to do.

Does anyone have any suggestions for tutorials or modules that implement custom exposed filters in a relatively simple way (e.g., not a huge number of custom handlers like the location module) that I can learn from?


texts: Alter a query using hook_views_query_alter() to filter a view by month

texts:
I successfully created a view gathering, let's say, events, sorted by date.  I also created exposed filters so one could filter the view.

I'm attempting to create another exposed filter that would filter the data on their field_date, but only by month. I quickly understood that this feature is not provided out of the box, so I managed to implement hook_views_query_alter() in the .views_execution.inc file.

This is what it contains.

function djm_views_query_alter(ViewExecutable $view, QueryPluginBase $query){
    if($view->id() == 'calendar'){
        $date_format = $query->getDateFormat("node__field_precise_date.field_precise_date_value", "m");
        $query->addWhere(5, $date_format, 12, "=");
    }
}

$date_format should return DATE_FORMAT('node__field_precise_date.field_precise_date_value', '%m').  The thing is that (I inspected the query my view outputs) the view totally strips my parentheses, percentage signs and, I guess, any special character, so it becomes DATE_FORMATnode__field_precise_date.field_precise_date_valuem.

Has anyone ever experience something like this?  I can't figure what to do to "fix" this. Am I using the right hook?


texts:
I'm trying to create a view that's like a randomizer like this: http://www.celebritynetworth.com/richest-celebrities/snooki-net-worth/.

I'm not sure out I could activate the view on a click of a button.  Then the view would have to display totally random nodes from the terms I've filtered it to display.  Would anyone know how I could do this?  Thank you.


texts: Set a condition for one field to be unique in all the content types.

texts:
I am working with Drupal 8, and have a custom post type called: chapter. This content type is connected with a taxonomy term called: Book.

Now, I have a field called: number, for specifying the chapter one, two or three. this field should be unique. For example, if I say chapter 1 I can not repeat it ever again in the same book, but I can upload the chapter 1 for another book. I also can upload all the chapters for the same book in a different order.

So the rule is: Just add a unique chapter number per book.

The final goal is to create a view and be able to order my chapters by the number.

Do I have to use the rules module for that? Or maybe, there is a better approach?.


texts:
This might be covered in another question but I couldn't find one with the same scenario I have, if there is one just point me to it please.

To make it simple I have 2 content types: Persons and Organisation

One thing admins should be able to enter about each person is how they are related to one or more organisations. So my first idea was to simply make a node-reference field with unlimited values and that should solve everything.

The problem is that for each of this connections I have to enter multiple fields. When I make a reference from a person I need to enter:

The reference itself
The type of relationship (employee, volunteer,
board member)
The level of the role played in the organisation
The position (text field) So, every time I make a "Add another field" I
should actually be adding 4 field and they all need to be "kept
together".

What is the best way to do this?

I was suggested to use the multifield module but I understand that it messes a lot with drupal structure and I want to keep things clean. I'm also worried how Views is going to work to a module like that.

I was also suggested to do a new reference content type in which I reference the Person node, the Organisation node and then the extra information fields. I think this is the "cleanest" way but the thing is... how do I make it easy for admins to be able to make this references while they are adding a new person? or if the person must be saved first to have a node id, immediately after and not just present a add node form after the other one (the admin will need to enter between 5 and 10 references and I don't want to make 10 redirects)

Thanks!


texts: How to calculate the sum for each option of all webform results in a Drupal webform grid?

texts:
I created a webform in drupal, and added a grid component in it. The grid has 13 questions and 3 options (good, bad, terrible). It's like a poll and people come and answer the questions.

In results, I already have the sum for each option in each question. What I also need is the sum for each option for all questions togehter. For example I need a sum row in grid footer!

I tried webform submissions in views, but it does not give me the data stored in grid.

Be aware that I'm noob in PHP and I don't know how to make TPL files.

image in this link says it all:

thanks


texts: Redirections and some content cannot be viewed

texts:
I´m new here. My site is built in Drupal 6.20. It is sending a 403 page for section content that has been published for a while. It seems that some redirections have disappeared as well although I can see them in the database.

I´m wondering whether it is a problem with the Global Redirect Module, or/and the views pages...I can´t see content from a specific type of view.

Can anybody help? Thanks a milliom


texts:
I have a view and I want to alter the output in each row.
So I have tried hook_views_pre_render(), and hook_preprocess_views_view(), but with no luck. In both of the above hooks I got data in $view->result, but there seems to be no way to change the rendered output.


texts: Can a javascript variable be made configurable?

texts: I defined a variable in my .js file and want the user/client to change that as per his needs. Is it somehow possible to use that value in forms in drupal?


texts:
In my drupal webform I have a node field ('custom_email_text') which is populated by a node id. I need the connected node text to be rendered in the email that is sent after the submission. I tried the following tokens but nothing seems to work:
[webform_submission:values:custom_email_text]
[webform_submission:values:custom_email_text:entity:body]
[webform_submission:values:custom_email_text:entity:body:*]

How can I achieve that?


texts: How to change the label of username field on all forms/pages that it occurs?

texts:
The following snippet changes the label of the username field on the user registration form from 'username' to 'nick-name' (when inserted into the template.php of the theme:

function my_theme_form_user_register_form_alter(&$form, &$form_state, $form_id) {

    $form['account']['name']['#title'] = t('nick-name');

}

To be consistent I'd like to change the label everywhere that it occurs in the system, such as the user settings form... how do I do that!


texts: Remove "add to cart button" when event date has passed

texts:
I'm making a webshop that sells tickets for events. And I want that the "Add to cart" button isn't displayed when the event date has passed. But I'm struggling with the Rules module.

Can someone help me out?
I'm using ubercart


texts:
How do I restrict the access to certain files based on their content type? I have the download section for registered users, and I want to prevent them to post links somewhere outside my site.

Is implementing hook_file_download() sufficient?

I tried this code and it's enough for my purpose, but the documentation of hook_file_download() doesn't help much.

function customize_file_download($uri) {
  global $user;
  if (!array_intersect(array('administrator','editor','expert','verified'), array_values($user->roles))) {
    return −1;
   }
}


texts: how to use function arg() in drupal to call .tpl files?

texts:
I have 3 .tpl files, how can i call these tpl files by using function arg().
 actually i want to show 3 different .tpl files to user when he request from a dropdown options.

The detail description is i want to create a page which render list of nodes in a page but i like to give option to user that weather he wants all the node in single column layout or 2 column layout or 3 column layout. For these layout i'm creating 3 different .tpl files so now i want to call them on the request of dropdown list.


texts: How to hide published content to anonymous user programmatically?

texts:
I have created a new content type programmatically and I would like to set permission so that anonymous users do not see this content when it is published.

How can I do this?


texts: I can't set a data value using rule on a custom entity

texts:
I have created a custom entity "Project" with this fields: id, name.

I have created a rule and added an action "create entity" and selected "Project".

I have added another action "Set a data value" and selected "name" of the newly created entity project and I had this message : "The selected data property doesn't support writing."

Here is the entity property info

 /**
 * Implements hook_entity_property_info().
 */
function project_entity_property_info() {

  $info = array();

  $info['project']['properties']['id'] = array(
    'label' => t('Project ID'),
    'description' => t('The ID of the project.'),
    'type' => 'integer',
    'schema field' => 'id',
  );

  $info['project']['properties']['name'] = array(
    'label' => t('Project name'),
    'description' => t('Name of the project.'),
    'type' => 'text',
    'schema field' => 'name',
  );
  $info['project']['properties']['description'] = array(
    'label' => t('Project description'),
    'description' => t('Description of the project.'),
    'type' => 'text',
    'schema field' => 'description',
  );
  $info['project']['properties']['deadline'] = array(
    'label' => t('Deadline'),
    'description' => t('Project deadline.'),
    'type' => 'date',
    'schema field' => 'deadline',
  );

  return $info;
}


texts:
I have a page view("/news") with contextual filter for the topics ("news/design","news/coding"...) which are taxonomy terms and this worked fine. Due to some changes for the mobile theming, I need a block view instead of the page view, but I can't get it to work with the filters.

With the old filter settings I get all my articles in "/news", but the filter I am using changed the default value from the filter to "taxonomy term ID from url";  I now see an empty page for "/news" (this is now a simple page with the block view included) and a "site not found" for "/news/design" etc. In the preview of the view, everything works fine.

These are the settings for the view.


texts:
I need to control the layout a particular, pre-existing node type using panels.  However unless I'm not mistaken, creating a panel for a node type allows you to manipulate the layout for every node of that type, whereas what I want is a default panels layout - which I can change if I need to - but free reign over adding new content elements for each node I create (of that type).

I could override the nodes individually by entering the un-aliased path for each node, e.g node/123.  However it's not very clean or intuitive, has to be done manually for each node, and I lose some useful information in my template pre-processing.

I could use the panels_node module, but this creates a new node type called "Panel", and while what I want is similar, the node type already exists - and I'd need the option of creating a new node type that uses panels later.

...or am I missing something really obvious?

Any help would be appreciated.

(Drupal 7, Panels 3)


texts: Migrating input formats for taxonomies with empty description

texts:
I am trying to write custom migrations to migrate my Drupal 7 website to Drupal 8. I am currently using Drupal 8.7.10 and Drupal 7.61 for a copy of the production website.

I have tried to migrate description from drupal 7 source and set format as "full_html" for drupal 8.

I have read a lot of sources, for example
Migrating input formats causes errors

I have used this code for migration

description/value: description
description/format: format2

and for process plugin

public function prepareRow(Row $row) {
  $row->setSourceProperty('format2', 'full_html');
}

but format didn`t saved for empty description.

How to save the format if the description is not filled?


texts:
I know this question is floating out there in the forums, but so far all of the answers I've come across over the weekend have been unable to resolve this issue.

I'm working on an Amazon LAMP server (Non-Ubuntu) and have been trying to enable the GD extension so that I may install Drupal 7 on my new AWS site.

The page installation process is producing the following error:

[X] PHP extensions Disabled: Drupal requires you to enable the PHP extensions in the following list (see the system requirements page for more information): gd

Here's what I know from my PHPInfo page: http://ec2-54-173-231-195.compute-1.amazonaws.com/info.php

I've gone ahead and run my scripts to install the gd script which I'm produced with the following result:

Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main/latest|2.1 kB 00:00
amzn-updates/latest | 2.3 kB 00:00
No package php5-gd available
Error: Nothing to do

I have also restarted my httpd and mysqld in efforts to restart the system and have my machine honor any restart needed to launch my extension recognition.

Any thoughts are appreciated.

Thanks!


texts:
I want to reward my users with 1 point for login every 24h.

Event: User has logged in

Condition: ??

Action: Reward points (I have a component)

I don't know how to reward once every 24 hours. how to?


texts: URL to access a private file within Drupal 7

texts:
I want to be able to have my Drupal 7 site allow both public and private downloads (see below configuration screen shot).

It appears that the private directory at: sites/default/files/private is preventing direct access to the files which is what I want and is allowing direct public access to the files within: sites/default/files which is also what I want.

My question is what URL do I use to call the private files so that my function hook_file_download($url) it called and then can decide based on a combination of the directory within the /private directory and the requesting users role whether they have access to view this file?


texts: How to use hook_pre_build depending on what time of day it is?

texts:
I need some help with the hook_pre_build hook in views. I am trying to set the image link on an image to off depending on what time of day it is and I cannot seem to find the syntax to change that fields settings.

I have searched a lot trying to find the right way to change this at this step and it is not working for me, any help?

function uc_custom_process_views_pre_build(&$view) {
$current_day = date('N');
$current_time =  date('Gi');
$open = 1600;
$results = &$view->result;
if ($view->name == 'uc_catalog') {
    foreach($results as $key => $result){
        $result->field['uc_product_image']->options['settings']['image_link'] ='';
    }
    if($current_time < $open){
        unset($view->field['buyitnowbutton']);
    }
    else{
        foreach($view->result as $r){
            $closes_at = $r->field_closes_at;
            if (($closes_at < $current_time)||($current_time < $open)){
                    unset($view->field['buyitnowbutton']);
                    $r->display_options['fields']['uc_product_image']['settings']['image_link'] = '';
            }
        }
    }
}
}


texts: Drush error during adding an install profile as platform

texts:
In Aegir, I add a platform with a buildfile:

core = 7.x
api = 2
projects[] = drupal
projects[profiler_drupal_base][type] = "profile"
projects[profiler_drupal_base][download][type] = "git"
projects[profiler_drupal_base][download][url] = "git@bitbucket.org:joachimroeleveld/profiler_drupal_base.git"
projects[profiler_drupal_base][download][branch] = "master"

I made an install profile which I pushed to the my public repository containing a .info, .make and .profile file (and the .build file so Aegir can read it).

After a bunch of tasks Aegir succeeded running (including downloading Drupal; the first step of the build file), I get this erors:

Unable to clone profiler_drupal_base from git@bitbucket.org:joachimroeleveld/profiler_drupal_base.git.
Could not download platform using drush make. No platform present

Is something wrong with the structure of my repo?


texts: Can we have multiple Normalizers in REST API?

texts: I have a requirement of exposing multiple content type data via different REST end point. I am using Normalizers to create an array as expected. For one content type it works perfect but when i try to add another normalizer with different name, flow is not coming to new one rather its going to old normalizer itself as both are extending the same class i.e ContentEntityNormalizer. I was jut trying to separate each content type normalizer to achieve more readability of code instead of working on same normalizer. Is there any way to achieve this?


texts: Can tokens be used to set values of other fields and in modules which use tokens?

texts:
I am finding the Metatag module rather unwieldy, and I want to create fields in the content type from which Metatag values will be set.

Are there tokens available for the fields of any arbitrary content type, that can be used, or a set formula for creating them?


texts:
I want bundle in hook_form_alter. In Drupal7 we can get all these in hook_form_alter.

I tried like this in D7:

function MYMODULE_form_alter(&$form, &$form_state, $form_id) {
  $bundle_type = $form['#bundle'];
}

Here I am getting bundle in D7.
Whereas in D8 I am not getting any bundle like article/page/tags etc.,


texts: Top Poster Per Taxonomy Term Block View?

texts:
I was thinking about make a block view showing who has posted the most posts per term. It will have a tax term argument (D6) I cant work out the best way to go or if its even possible with Views.

Does anyone have any suggestions? Thanks


texts: The site has a mix of modules installed manually and via Composer: Can I move all to Composer?

texts:
I've inherited a Drupal 8 site where only few modules were installed via Composer; the rest was manually installed.

Is there a way to fix this, and move the manually installed modules to be handled by Composer?


texts: Views filter criteria date field is greater than current date

texts:
I have a overview page with different events. Now it shows all events which were created. But I will that it just shows all the future events.

The content type has a datefield for the eventdate. I selected the field_date_event by the filter criteria but there I can not enter the token [current-date] or a dateformat like d.m.y.

How can I solve this problem?


texts: Getting specific property from node_load

texts:
I have an article that I've set to a variable like this:

$this_node = node_load($nid);

I've done a print_r on $this_node and this is what I get - it's pretty long, sorry:

stdClass Object
(
    [nid] => 67572
    [type] => imagevault
    [language] =>
    [uid] => 3
    [status] => 1
    [created] => 1303347600
    [changed] => 1305662899
    [comment] => 0
    [promote] => 0
    [moderate] => 0
    [sticky] => 1
    [tnid] => 0
    [translate] => 0
    [vid] => 67572
    [revision_uid] => 1
    [title] => Anne Jones
    [body] =>
    [teaser] =>
    [log] =>
    [revision_timestamp] => 1305662899
    [format] => 2
    [name] => pbreen
    [picture] =>
    [data] => a:0:{}
    [field_pub_date] => Array
        (
            [0] => Array
                (
                    [value] =>
                    [timezone] => America/Chicago
                    [timezone_db] => America/Chicago
                    [date_type] => date
                )

        )

    [field_att_file] => Array
        (
            [0] => Array
                (
                    [fid] => 59327
                    [uid] => 3
                    [filename] => KCJones.jpg
                    [filepath] => sites/default/files/images/KCJones.jpg
                    [filemime] => image/jpeg
                    [filesize] => 54806
                    [status] => 1
                    [timestamp] => 1304023490
                    [list] => 1
                    [data] => Array
                        (
                            [description] =>
                        )

                )

        )

    [path] => imagevault/67572

    [0] =>
    [taxonomy] => Array
        (
            [264] => stdClass Object
                (
                    [tid] => 264
                    [vid] => 15
                    [name] => Kimberly-Clark
                    [description] =>
                    [weight] => 0
                )

            [137] => stdClass Object
                (
                    [tid] => 137
                    [vid] => 10
                    [name] => People
                    [description] =>
                    [weight] => 0
                )

        )

)

I know I can get certain values from the node like this:

$imagefile = array();
$imagefile['name'] = $this_node->field_att_file[0]['filename'];

Here's what I need to do, though (and I'm very new to Drupal so forgive me if this is really simple.) The article can, as shown, have multiple taxonomy terms. I need to treat a chunk of display code differently if the article has 137 as one of the taxonomy terms. How would I go about this?

Something like this, or is there a better way? (Don't even know if this way works yet; it probably won't since each tax term is an object, not an array.)

$this_tax = $this_node->taxonomy;
if (array_key_exists('137', $this_tax)) {
   // Do stuff
}


texts: I want to build a pie chart to make a statistic for all my events. But, there are a lot of module. I want to know what's the best and responsive? I'm using drupal


texts: Panels problem with changing the width of columns or regions

texts:
Some times when I try to change the width of columns or regions with Fluid Width the panels displays the NAN% and it doesn't change the width

Using Firebug I got the following error

What should I do?

UPDATE

It only displays this javascript error in console in flexible-admin.js file

splitter.parent.css('padding-right', (splitter.right_padding + moved) + 'px');


texts: Adding extra info to each Node -> Taxonomy Term relationship

texts:
We have a basic site with a pages that have a taxonomy term content type associated with a number of terms.

What we would like to is to add more information to each of the node -> taxonomy relationship.

For example, the details of the author that tagged the term(different authors can tag a term to a node), the date the particular tag was added and so on.

I have looked at the Entity API, the Relation module and various other solutions in between.

From what I can tell, Entity Reference along with the Entity API seems to be the simplest way forward.

While I am not loathe to get my hands dirty and start coding this out, my knowledge of how each of these things fit together is limited.

Can someone point me in the right direction and point out any potential pitfalls along the way with regards to getting this done?


texts:
I've successfully printed a comment form on a views-built page using a PHP Views field (as found in this question). The form doesn't submit right away though - instead of submitting, the comment "save" button redirects to the "comment/reply/[nid]" page with blank values.

Comment form print code:

$comment = new stdClass;
$comment->nid = $row->nid;
$form = drupal_get_form('comment_form', $comment);
print render($form);

Are there extra details that should be added to the $comment object before or during the drupal_get_form() or render() calls?


texts: Is Drupal internationalization development effort embracing the new "Entity Translation" method? Is it ready for use?

texts:
I'm working on standing up a new Drupal 7 site that will have content in multiple versions, and as I'm reviewing the i18n module, I see that there are now two methods for translating content: "Content Translation" and "Entity Translation."

However, the articles I've found on this are all several years old. I would have expected that, by now, there would be consensus built around the "blessed" method of doing content translation, but I can't seem to find anything except "we're moving towards entity translation, hopefully it will be done soon," and this is all in posts that are years old--so maybe by now it is done? But I just can't find the posts saying it's ready?

So, is "Entity Translation" ready for prime-time, and it's the current method recommended by Drupal (the team)? I'm looking for an authoritative reference (e.g., post by someone on Drupal or i18n team, or a respected Drupal community member), that gives the current state of affairs for Drupal internationalization.

Thanks!


texts: From time to time, the system does not find a file that exists

texts:
From time to time (1 in 20 pages or so), I receive the following Drupal error:

Warning: file_get_contents(/sites/all/themes/MYTEMPLATE/lightGallery/dist/js/lightgallery.js):
failed to open stream: No such file or directory in _locale_parse_js_file()
 (line 1488 of /home/[MACHINE_NAME]/domains/[DOMAIN_URL]/public_html/includes/locale.inc).

The folder has permissions, it works perfectly, but the error message is persistent. I don't know why it happens and how to avoid it.


texts: Custom submit handler on form loaded via entity.form_builder

texts:
Using Drupal 8.5.3. Currently working within a custom controller to load and alter a form for menu links. To load the form I am using the following:

// Load the menu link field.
  $menu_link_content = MenuLinkContent::create([
    'title' => 'Example link',
    'link' => ['uri' => 'internal:/node'],
    'menu_name' => 'main',
  ]);

  $form = \Drupal::service('entity.form_builder')->getForm($menu_link_content, 'default', $form_state_params);

Simple enough right? From there I go onwards to alter $form inside the same method in the controller. I can change the $form values from there to adjust which menu items are available.

The problem is that I can't seem to add a submit handler.

I've tried both of these to add a submit handler, to no avail.

$form['#submit'][] = 'group_content_submenu_group_link_add_submit';
$form['actions']['submit']['#submit'][] = 'group_content_submenu_group_link_add_submit';

Any ideas on what I could be missing? I'm open to other approaches as well, but I specifically need to be able to set the parent item that this form should be using to present available parent menu link choices.


texts: I have a new installation and I have "No front page content has been created yet".  How do I configure this front page?  How do I give a new user the ability to create their own blogs whilst also preventing them from having full control of the system?


texts: On the orders admin page you have options to change fields in your table and sort fields, ect. In the headers option I have 'global: view order form' selected, and above the table there is a box where you can search for order numbers. I want to be able to not only search for order numbers, but also search for customer names, dates, money amounts, ect. Can you add in search criteria to that header?


texts: limit access to private files uploaded by webform to specific role

texts:
In my Drupal 7 site, I have a webform where anonymous users upload a file
(typically, their CV). The webform is configured to save it in the private file system. How can I achieve that the uploaded files are accessible only to authenticated users who belong to a specific role ?
(at this moment they are accessible only to the admin user)

thanks


texts: Display members of Organic Groups that are members of a given Organic Group in Views

texts:
Suppose I have an OG called "Color"
Then, suppose I have OG Groups called:
"Red"
"White"
"Blue"

Within of "Red", there are users that are members.

It is easy to define a filter to display members of "Red".

What I want to do is have a view that displays members of "Red", "White" and "Blue" because each of those OGs are members of "Color".

How do I do that without making each member belong to both "Red", and "Color"?


texts:
Usually I need the contextual gear-icon menu that is missing from row-themed views. The tools provide a quick access to each node. So I insert Content: Edit Link field into the View and the template.

What kind of if should I put in the code to make the link accessible only by those authorized to edit the given node type?

Currently I have if(user_is_logged_in()): which is ok as a temporary solution, as the site does not create any users by itself, but we know this is not what should be there in the code.

Please remember: I do not want to control accessibility of an entire View, just the display of restricted field.


texts: Use Timeago date format for less than 24h ago only

texts:
I would like to use the Timeago module as a date format. However, when the time ago has exceeded 24h, I would like it to show another format (e.g. 4 Feb, 2013) much like Twitter or Dribbble use.

I tried to tweak the code, but my skills let me down :/

Is there possibly a better module for this cause? Or do I have to make my own?

I found this code that shows how I want it to work, however I have no idea how to implement this to drupal.

Any help is appreciated, thanks.